- 博客(202)
- 收藏
- 关注
转载 Codeforces_846
A.简单dp。#include<bits/stdc++.h>using namespace std;int n,a[105],dp[105][2] = {0};int main(){ ios::sync_with_stdio(0); cin >> n; for(int i = 1;i <= n...
2017-09-06 19:33:00
266
转载 Codeforces_851
A.分三种情况。#include<bits/stdc++.h>using namespace std;int n,k,t;int main(){ ios::sync_with_stdio(0); cin >> n >> k >> t; if(t <= k) cout ...
2017-09-05 20:53:00
236
转载 iomanip、cstring、string、sstream
#include<iomanip> 控 制 符 作 用dec设置整数为十进制hex设置整数为十六进制oct设置整数为八进制...
2017-09-03 01:57:00
176
转载 数学结论、计算几何
排列组合圆排列有限多重集的排列 n!/(n1!*n2!*...*nk!)n元无限集可重-r组合C(n+r-1,r)种。n元无限集取r个,n中每个至少出现一次C(r-1,n-1)(r≥n)直线分平面:f(1) = 2f(n) = f(n-1)+n = n(n+1)/2+1折线分平面:f(1) = 2f(n) = f(n-1)+4(n-1)...
2017-09-03 01:57:00
245
转载 字符串
//普通void getnext1(char *s){ int i = 0,j = -1,len = strlen(s); ne[0] = -1; while(i < len) { if(j == -1 || s[i] == s[j]) ne[++i] = ++j; else j ...
2017-09-02 22:38:00
85
转载 图论
最短路://权值非负,不连通为INF、//O(n^2)void dij(int beg){ memset(dis,0x3f,sizeof(dis)); memset(vis,0,sizeof(vis)); dis[beg] = 0; for(int i = 1;i <= n;i++) { i...
2017-09-02 22:38:00
143
转载 数据结构
void init(){ for(int i = 1;i <= n;i++) pre[i] = i;} int findd(int x) 递归 { return pre[x] == x?x:pre[x] = findd(pre[x]);}void join(int a,int b){ ...
2017-09-02 22:38:00
242
转载 动态规划
int dp[1005][1005] = {0},len1,len2;char a[1005],b[1005];void lcs(){ for(int i = 1; i <= len1;i++) { for(int j = 1;j <= len2;j++) { if(...
2017-09-02 22:37:00
81
转载 数论
int cnt,prime[MAXN+1],mi[MAXN+1],vis[MAXN+1];//cnt表示素数个数//prime存放每个素数//mi存放每个数的最小素数因子void getprime(){ cnt = 0; memset(prime,0,sizeof(prime)); for(int i = 2;i <...
2017-09-02 22:37:00
136
转载 头文件、输入挂、随机数
#pragma comment(linker, "/STACK:102400000,102400000")#include<cstdio>#include<iostream>#include<iomanip>#include<algorithm>#include<cmath>#include&...
2017-09-02 01:56:00
115
转载 Codeforces_849
A.只要考虑分成一个串的情况就可以了。#include<bits/stdc++.h>using namespace std;int n,a[105];int main(){ ios::sync_with_stdio(0); cin >> n; for(int i = 1;i <= n;i++)...
2017-09-02 01:32:00
137
转载 Codeforces_842
A.枚举一个区间,判断是否有数符合。#include<bits/stdc++.h>using namespace std;long long l,r,x,y,k;int main(){ ios::sync_with_stdio(0); cin >> l >> r >> x >&g...
2017-08-30 03:37:00
89
转载 Codeforces_844
A.统计字母个数。#include<bits/stdc++.h>using namespace std;string s;int n;map<char,int> mp;int main(){ ios::sync_with_stdio(0); cin >> s >> n; ...
2017-08-26 21:24:00
127
转载 Codeforces_845
A.排序,比较中间两个大小。#include<bits/stdc++.h>using namespace std;int n,a[205];int main(){ ios::sync_with_stdio(0); cin >> n; for(int i = 1;i <= 2*n;i++) ci...
2017-08-26 19:34:00
119
转载 Codeforces_101498
A.map统计数量,更新最大值。#include<bits/stdc++.h>using namespace std;int n;map<int,int> mp;int main(){ ios::sync_with_stdio(0); int T; cin >> T; wh...
2017-08-26 18:33:00
160
转载 Codeforces_841
A.统计每个字母数量,比较是否超过k。#include<bits/stdc++.h>using namespace std;int n,k,cnt[26] = {0};string s;int main(){ ios::sync_with_stdio(0); cin >> n >> k >...
2017-08-19 09:12:00
237
转载 Codeforces_839
A.每天更新判断。#include<bits/stdc++.h>using namespace std;int n,k,a[105];int main(){ ios::sync_with_stdio(0); cin >> n >> k; for(int i = 1;i <= n;i...
2017-08-18 22:25:00
118
转载 Codeforces_837
A.扫一遍。#include<bits/stdc++.h>using namespace std;int n;string s;int main(){ cin >> n; getchar(); getline(cin,s); int ans = 0,maxx = 0; for...
2017-08-18 10:00:00
117
转载 Codeforces_834
A.两个方向都判断。#include<bits/stdc++.h>using namespace std;string s1,s2;map<char,int> mp;int n;int main(){ ios::sync_with_stdio(0); mp['v'] = 0; mp['<...
2017-08-01 18:35:00
156
转载 Codeforces_835
A.比较两人总时间。#include<bits/stdc++.h>using namespace std;int s,v1,v2,t1,t2;int main(){ ios::sync_with_stdio(false); cin >> s >> v1 >> v2 >> t...
2017-08-01 14:21:00
82
转载 Codeforces_813
A.统计总时间,从总时间开始找第一个能提交的点。#include<bits/stdc++.h>using namespace std;int n,m,a[1005],ok[100005] = {0};int main(){ ios::sync_with_stdio(0); cin >> n; int...
2017-07-29 01:01:00
93
转载 Codeforces_814
A.b序列从大到小填a序列中的0,在判断。#include<bits/stdc++.h>using namespace std;int n,m,a[105],b[105];int main(){ ios::sync_with_stdio(0); cin >> n >> m; for(in...
2017-07-29 00:10:00
110
转载 Codeforces_817
A.要求坐标差为移动距离的两倍。#include<bits/stdc++.h>using namespace std;int main(){ ios::sync_with_stdio(0); int x1,x2,y1,y2,x,y; cin >> x1 >> y1 >> x2 >...
2017-07-27 23:48:00
87
转载 Codeforces_816
A.不断增加时间,直到符合要求。#include<bits/stdc++.h>using namespace std;int a,b;char c;int f(int x){ return x%10*10+x/10;}int main(){ ios::sync_with_stdio(0); ...
2017-07-27 14:42:00
145
转载 Codeforces_821
A.直接判断每一个数。#include<bits/stdc++.h>using namespace std;int n,a[55][55];int main(){ ios::sync_with_stdio(0); cin >> n; for(int i = 1;i <= n;i++) ...
2017-07-27 00:17:00
184
转载 Codeforces_832
A.判断n/k的奇偶性。#include<bits/stdc++.h>using namespace std;long long n,k;int main(){ ios::sync_with_stdio(0); cin >> n >> k; long long t = n/k; ...
2017-07-25 11:54:00
175
转载 Codeforces_820
A.直接模拟。#include<bits/stdc++.h>using namespace std;int c,v0,v1,a,l;int main(){ ios::sync_with_stdio(0); cin >> c >> v0 >> v1 >> a >>...
2017-07-24 22:29:00
87
转载 Codeforces_818
A.winners总数为(k+1)diplomas。#include<bits/stdc++.h>using namespace std;long long n,k;int main(){ ios::sync_with_stdio(0); cin >> n >> k; long long...
2017-07-24 12:28:00
141
转载 Codeforces_822
A.小的那个数的阶乘。#include<bits/stdc++.h>using namespace std;int a,b;int main(){ ios::sync_with_stdio(0); cin >> a >> b; int t = min(a,b); int an...
2017-07-24 00:09:00
100
转载 Codeforces_828
A.模拟,注意单人的时候判断顺序。#include<bits/stdc++.h>using namespace std;int n,a,b;int main(){ ios::sync_with_stdio(0); cin >> n >> a >> b; int b1 = b,...
2017-07-23 23:46:00
172
转载 Codeforces_831
A.线性判断。#include<bits/stdc++.h>using namespace std;int n,a[105] = {0};int main(){ ios::sync_with_stdio(0); cin >> n; for(int i = 1;i <= n;i++) cin...
2017-07-23 14:27:00
126
转载 Codeforces_825
A.连续1的个数,0用来分割,注意连续的0。#include<bits/stdc++.h>using namespace std;int n;string s;int main(){ ios::sync_with_stdio(0); cin >> n >> s; int now = ...
2017-07-19 11:40:00
134
转载 Codeforces_812
A. 每条人行道有六条车道会撞到。#include<bits/stdc++.h>using namespace std;int a[4],b[4],c[4],d[4];int main(){ ios::sync_with_stdio(0); for(int i = 0;i < 4;i++) cin >&...
2017-06-03 00:33:00
97
转载 Codeforces_794
A.统计两个guard之间的钞票数。#include<bits/stdc++.h>#define MOD 1000000009using namespace std;int a,b,c,n;int main(){ ios::sync_with_stdio(false); cin >> a >>...
2017-05-14 02:42:00
138
转载 Codeforces_799
A.求两个时间比较一下。#include<bits/stdc++.h>using namespace std;int n,t,k,d;int main(){ ios::sync_with_stdio(false); cin >> n >> t >> k >> d; ...
2017-05-13 02:35:00
48
转载 Codeforces_807
A. 严格按照题目给的两个条件来。#include<bits/stdc++.h>using namespace std;int n,a[1005],b[1005];int main(){ ios::sync_with_stdio(false); cin >> n; for(int i = 1;i &...
2017-05-08 15:57:00
112
转载 Codeforces_805
A.当l == r时,肯定输出这个数就可以了,当存在两个或两个以上连续的数时,2肯定是最多的数,或最多的数之一。#include<bits/stdc++.h>using namespace std;int l,r;int main(){ ios::sync_with_stdio(false); cin >> ...
2017-05-05 23:18:00
105
转载 2017西电第一次省赛选拔赛补题
https://vjudge.net/contest/161101#overviewA.判断B是否能整除A的每一个素因子。#include<bits/stdc++.h>using namespace std;int prime[1000005],vis[1000005] = {0};long long a,b;int main()...
2017-05-05 01:05:00
123
转载 Codeforces_793
A.找最小的数,看每个数跟它的差是否被k整除。#include<bits/stdc++.h>#define MOD 1000000007using namespace std;int n,cnt[100005] = {0},ans[100005],two[100005];int main(){ ios::sync_with_s...
2017-05-02 06:28:00
155
转载 Codeforces_803
A. 填k个1,使矩阵主对角线对称,相同情况选择上面1数量多的。#include<bits/stdc++.h>using namespace std;int n,k,a[105][105] = {0};int main(){ ios::sync_with_stdio(false); cin >> n >...
2017-05-02 05:06:00
54
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人