cf
文章平均质量分 67
真的好难
因为热爱,所以才一步一步走下去。。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
cf 102 A(暴力)
链接:http://codeforces.com/problemset/problem/102/A#include using namespace std;int a[105],ma[105][105];int main(){ int n,m; scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) sca原创 2016-07-12 19:25:33 · 380 阅读 · 0 评论 -
cf 87 A
链接:http://codeforces.com/problemset/problem/87/A 模拟下就知道了。。#include using namespace std;#define ll long longll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b);}int main(){ ll a,原创 2016-07-11 09:59:02 · 362 阅读 · 0 评论 -
cf 55A(暴力 )
链接:http://codeforces.com/problemset/problem/55/A 直接暴力 ..#include using namespace std;#define ll long longconst int maxn=100005;mapm;int main(){ int n; scanf("%d",&n); ll res原创 2016-07-12 17:45:42 · 267 阅读 · 0 评论 -
cf 44 A
链接:http://codeforces.com/problemset/problem/44/A直接判重#include using namespace std;string s1,s2;map,int> m;int main(){ int n; scanf("%d",&n); while(n--) { cin>>s1>>s2;原创 2016-07-12 18:18:17 · 386 阅读 · 0 评论 -
cf 551 C(二分)
链接: http://codeforces.com/problemset/problem/551/C 思路:二分查找所需的时间t,m个人都有t个单位的时间,从后往前清空,直到答案最优#include using namespace std;#define ll long longint a[100005],b[100005];int main(){ in原创 2016-07-12 18:32:12 · 631 阅读 · 0 评论 -
cf 260 C(模拟)
链接:http://codeforces.com/problemset/problem/260/C 思路:模拟往回推的过程,正常肯定超时,所以可以先将数据中的最小值取出,将每一个数都减去这个最小值,再模拟就好#include using namespace std;#define ll long longll a[100005];int main(){ ll n原创 2016-07-12 18:39:31 · 454 阅读 · 0 评论 -
cf 488 B(暴力)
链接:http://codeforces.com/problemset/problem/488/B#include using namespace std;int a[10],b[10];int judge(){ sort(b,b+4); if(b[3]==3*b[0]&&b[2]+b[1]==4*b[0]) return 1; els原创 2016-07-12 18:47:39 · 287 阅读 · 0 评论 -
cf 75 C(gcd)
链接:http://codeforces.com/problemset/problem/75/C 求出a,b的gcd c,求出c的因子,判断是否在区间中#include using namespace std;int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}int arr[10000];int main(原创 2016-07-12 18:51:24 · 503 阅读 · 0 评论 -
cf 432 C
链接:http://codeforces.com/problemset/problem/432/C 任意一个大于2的合数等于两个素数相加,只要知道这个定理就不难了。将每个元素的值作为下标,记录该元素所在的位置,排序的时候判断该点是否为本身,不是得话就去判断两点之间的距离是否为素数,不是变为两个素数相加即可,具体看代码#include usi原创 2016-07-12 19:01:23 · 454 阅读 · 0 评论 -
cf 337 D(dfs)
链接:http://codeforces.com/problemset/problem/337/D 找到已经被攻击的最远距离的两个点,再遍历其他点到这两点之间的距离,当两点之间的距离都小于d,这符合题意 #include using namespace std;const int maxn=1e5+5;int n,m,d;int a[maxn],dist1[maxn],dist原创 2016-07-12 19:06:23 · 1380 阅读 · 0 评论 -
cf 689 A
链接:http://codeforces.com/problemset/problem/689/A 直接将给的向量四个方向平移一次看是否有符合的#include using namespace std;#define ll long longconst int maxn=1e5+10;int n;char s[maxn],str[maxn];int flag[4]原创 2016-07-12 19:11:52 · 780 阅读 · 0 评论 -
cf 689 C(二分)
链接:http://codeforces.com/problemset/problem/689/C#include using namespace std;#define ll long longll get(ll n){ ll ans=0; for(ll k=2;k*k*k<=n;k++) ans+=n/(k*k*k); return原创 2016-07-12 19:14:31 · 473 阅读 · 0 评论 -
cf 433 C(思维题)
链接:http://codeforces.com/problemset/problem/433/C 思路:可以先计算总的消耗,接着计算将某一类型的所有数字更换成相邻的数字之后所降低消耗的最大值。。可以枚举每一个数换成相邻的数字之后减低的消耗,正常枚举肯定会超时。所以需要我们先求出每一个相邻数字的前缀和,接着枚举一个可以用o(1)的时间算出降低的消耗,具体看代码#原创 2016-07-11 09:52:29 · 674 阅读 · 0 评论 -
cf 681 C(模拟)
链接:http://codeforces.com/problemset/problem/681/C 优先队列去模拟#include using namespace std;priority_queue,greater >q;char s[100],ss[100];vectorv;int main(){ int n,val; scanf("%d",&n);原创 2016-07-15 21:34:01 · 1097 阅读 · 0 评论 -
cf 686 D
链接:http://codeforces.com/problemset/problem/686/D 寻找以i为根的子树的重心 当我们要求ans[i]的时候可以发现ans[i]一定会在i节点儿子中数量最多的子树当中,所以层层往上推 直到ans[i]=i || d[i]-d[ans[i]]#include using namespace std;const int N=3e5+原创 2016-07-15 21:44:00 · 2040 阅读 · 0 评论 -
cf 697 C
链接:http://codeforces.com/problemset/problem/697/C 每次操作都查找两点的最近的公共祖先,查找的同时更新路径权值或者求最短路径代价#include using namespace std;#define ll long longmap,ll>m;int main(){ int n; scanf("%d",&n)原创 2016-07-15 21:47:01 · 1046 阅读 · 0 评论 -
cf 697 B(模拟)
链接:http://codeforces.com/problemset/problem/697/B 直接按题意模拟。。。#include using namespace std;char s[100000],d[100000],e[100000];int main(){ int a,b; while(~scanf("%s",s)){ sscanf(s,"%d.原创 2016-07-15 21:48:48 · 762 阅读 · 0 评论 -
cf 697 A
链接:http://codeforces.com/problemset/problem/697/A#include using namespace std;int main(){ int n,m,k; scanf("%d%d%d",&n,&m,&k); if(k<n)printf("NO\n"); else if(k==n)printf("YES原创 2016-07-15 21:50:28 · 555 阅读 · 0 评论 -
cf 682 C (树形dp)
链接:http://codeforces.com/problemset/problem/682/C dp[v]表示以v为终点所需消耗的最大值 当d[v]大于a[v]时就删除以v为根节点的子树#include using namespace std;#define ll long longconst int N=1e5+5;vector >G[N];ll n,a[原创 2016-07-15 21:54:29 · 1848 阅读 · 0 评论 -
cf 686 B
链接:http://codeforces.com/problemset/problem/686/B#include using namespace std;int a[200];int main(){ int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",a+i); for(in原创 2016-07-15 21:56:26 · 1439 阅读 · 0 评论 -
cf 437 D(并查集)
链接:http://codeforces.com/problemset/problem/437/D 两个集合A,B的个数分别n,m,当着两个集合通过f(a,b)连通时f(a,b)是最小的边,题目结果为n*m*f(a,b)*2 所以可以将边从大到小排序之后,用并查集维护并计算个数#include using namespace std;#define ll long lo原创 2016-07-12 19:22:26 · 537 阅读 · 0 评论 -
cf 689 B(最短路)
链接:http://codeforces.com/problemset/problem/689/B #include using namespace std;#define ll long longconst int maxn=2e5+10;const int inf=(1<<30);vectorve[maxn];int n;//fuc原创 2016-07-12 19:09:41 · 722 阅读 · 0 评论 -
cf 602 C(最短路)
C. The Two Routestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn Absurdistan, there are n towns (number原创 2015-11-25 19:25:54 · 571 阅读 · 0 评论 -
cf 602 B(模拟)
B. Approximating a Constant Rangetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhen Xellos was doing a p原创 2015-11-25 19:24:38 · 732 阅读 · 0 评论 -
cf 583 B. Robot's Task(模拟)
链接:http://codeforces.com/problemset/problem/583/B//求改变的方向次数//直接模拟 题目是从1 开始 所以从左到右 从右到左#include #include using namespace std;int a[1000+10];int vis[1000+10];int main(){ int n,t=0原创 2015-10-05 23:43:20 · 408 阅读 · 0 评论 -
cf 580 c(邻接表+dfs)
C. Kefa and Parktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKefa decided to celebrate his first big sa原创 2015-09-23 13:34:24 · 777 阅读 · 0 评论 -
cf 567C
C. Geometric Progressiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp loves geometric progressio原创 2015-09-08 15:09:12 · 779 阅读 · 0 评论 -
cf 580 A
A. Kefa and First Stepstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKefa decided to make some money doi原创 2015-09-23 13:29:48 · 633 阅读 · 0 评论 -
cf 580B
B. Kefa and Companytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKefa wants to celebrate his first big s原创 2015-09-23 13:32:21 · 605 阅读 · 0 评论 -
cf 598 A
A. Tricky Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn this problem you are to calculate the sum o原创 2015-11-14 01:28:03 · 583 阅读 · 0 评论 -
cf 598 B
B. Queries on a Stringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s and should原创 2015-11-14 01:28:49 · 639 阅读 · 0 评论 -
cf 598 d
D. Igor In the Museumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIgor is in the museum and he wants to原创 2015-11-14 01:29:56 · 549 阅读 · 0 评论 -
CF 505 B (dfs)
链接:http://codeforces.com/problemset/problem/505/B#include using namespace std;int to,res,n,m;int c[105][105][105];int d[105][105];int ans[105];bool vis[105][105][105];void dfs(int v,int co)原创 2015-10-14 16:12:36 · 412 阅读 · 0 评论 -
cf 602 A(进制转换)
A. Two Basestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter seeing the "ALL YOUR BASE ARE BELONG TO U原创 2015-11-25 19:23:29 · 354 阅读 · 0 评论 -
cf 349 B. Color the Fence(贪心)
链接:http://codeforces.com/problemset/problem/349/B//其实一开始想写dp 结果愣是没写出来 。。。丢人//贪心:选取体积最小的 接着从剩余的体积加上每一个最小的看看能不能替换比他大的数。。看代码 - -#include using namespace std;int a[10];int res[1000000+10];原创 2015-10-05 23:40:12 · 519 阅读 · 0 评论 -
cf 599 B (stl)
B. Spongebob and Joketime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhile Patrick was gone shopping, Spon原创 2015-11-25 20:21:14 · 486 阅读 · 0 评论 -
cf 599 C (模拟+STL)
C. Day at the Beachtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Squidward, Spongebob and Patric原创 2015-11-25 20:26:20 · 718 阅读 · 0 评论 -
cf 653
http://codeforces.com/contest/653/problem/A//排序去重后判断是否有3个连续相差为1的数#include using namespace std;int a[1000];int main(){ int n; scanf("%d",&n); for(int i=0;i<n;i++) {原创 2016-04-03 19:34:12 · 623 阅读 · 0 评论 -
cf 675 A
A. Infinite Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya likes everything infinite. Now he原创 2016-05-24 15:57:18 · 334 阅读 · 0 评论 -
cf 675 B
B. Restoring Paintingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya works as a watchman in the galle原创 2016-05-24 16:02:39 · 391 阅读 · 0 评论
分享