
codeforces
Mr.Gzj
这个作者很懒,什么都没留下…
展开
-
Powers Of Two
题目链接思路:二进制,当时没写出来,现在一看,也不难,很生气。#include<cstdio>#include<iostream>#include<algorithm>using namespace std;typedef long long ll;int main(){ int n, k; cin >> n >...原创 2018-12-28 01:05:36 · 182 阅读 · 0 评论 -
Codeforces Round #546 (Div. 2) C - Nastya Is Transposing Matrices
思路:按斜着的行遍历,因为斜着的数字无论怎么转置都一样。#include<iostream>#include<algorithm>#include<cstdio>#include<cstring>#include<string>#include<set>#include<map>#include原创 2019-03-12 21:54:57 · 184 阅读 · 0 评论 -
Codeforces Round #544 (Div. 3)
A. Middle of the Contest思路:签到题,不多说。#include<bits/stdc++.h>#define INF 0x3f3f3f3f#define ll long long#define mem(ar,num) memset(ar,num,sizeof(ar))#define me(ar) memset(ar,0,sizeof(ar))#...原创 2019-03-10 21:14:27 · 202 阅读 · 0 评论 -
2018 JUST Programming Contest 1.0 H. Genta Game
水题一道,不过我为什么要将她记录下来呢,在wa了无数次后,我胡乱的吧输入同步(#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);)取消掉了,结果就ac了,看来以后还是打scanfprintf好,不能再偷懒了。#include <bits/stdc++.h>#define fi first#define s...原创 2019-03-14 11:52:58 · 246 阅读 · 0 评论 -
Maratona de Programa¸c˜ao da SBC – ACM ICPC – 2013 H
思路:这是一道矩阵快速幂的题目,求出需要的矩阵来,在乘以初始状态就好了。#include <set>#include <map>#include <deque>#include <queue>#include <stack>#include <cmath>#include <ctime>#i原创 2019-02-25 21:54:29 · 673 阅读 · 0 评论 -
Educational Codeforces Round 60 (Rated for Div. 2) D. Magic Gems
思路:矩阵快速幂,根据递推的特性列出矩阵,直接求解,主要注意n<m的情况#include<bits/stdc++.h>#define INF 0x3f3f3f3fusing namespace std;typedef long long ll;ll n, m;const int N = 105;const ll mod = 1000000007;stru...原创 2019-02-27 16:34:09 · 187 阅读 · 0 评论 -
Lunar New Year and Food Ordering
题目链接#include<bits/stdc++.h>#define INF 0x3f3f3f3f#define ll long long#define mem(ar,num) memset(ar,num,sizeof(ar))#define me(ar) memset(ar,0,sizeof(ar))#define lowbit(x) (x&(-x))#de...原创 2019-02-03 22:01:02 · 244 阅读 · 0 评论 -
Lunar New Year and a Wander
题目链接思路:BFS,利用优先队列。#include<bits/stdc++.h>#define INF 0x3f3f3f3f#define ll long long#define mem(ar,num) memset(ar,num,sizeof(ar))#define me(ar) memset(ar,0,sizeof(ar))#define lowbit(x) ...原创 2019-02-03 00:15:14 · 179 阅读 · 0 评论 -
C. New Year and the Sphere Transmission
C. New Year and the Sphere TransmissionThere are nn people sitting in a circle, numbered from 11 to nn in the order in which they are seated. That is, for all ...原创 2018-12-31 14:49:11 · 584 阅读 · 4 评论 -
C. Polygon for the Angle
You are given an angle angang.The Jury asks You to find such regular nn-gon (regular polygon with nn vertices) that it has three vertices aa, bb and cc (they can be non-consecutive) with ∠abc=ang∠ab...原创 2018-12-29 14:33:15 · 517 阅读 · 2 评论 -
B. Substring Removal
You are given a string ss of length nn consisting only of lowercase Latin letters.A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "code...原创 2018-12-29 11:12:00 · 765 阅读 · 0 评论 -
Codeforces Round #545 (Div. 2) D. Camp Schedule
https://codeforces.com/contest/1138/problem/D看了半天,才发现要用kmp,不过kmp一个多月前学会了就没用过,都不会写了,又复习了一遍。思路:利用kmp的next数组,可以知道按最长前缀后缀一样的长度来输出,最后再补上剩下的,没什么难的,就是南想到kmp#include <bits/stdc++.h>#define fi fi...原创 2019-03-13 17:59:07 · 286 阅读 · 0 评论