随笔分类 - CF
摘要:................................目录..................................Round #167 (Div. 2)A.Dima and Friends 类型: 模拟题意:有n个朋友每个人出1~5中的一个数,自己可以出1~5中的任意一个数,把所有数的和加起来得到的m,从自己开始一次倒数 最后一个人扫地,问自己有多少种出法,自己不用扫地。分析:直接模拟View Code #include <cstdio>#include <cstring>#include <algorithm>#include <
阅读全文
摘要:A.Beautiful Year题意:找到大于y的第一个每位都不相同的年。View Code #include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace std;#define clr(x) memset(x,0,sizeof(x))int a[4];int main(){ int y; while (scanf("%d",&y)!=EOF) { y++; for (;;y++) { int x = ...
阅读全文
摘要:A.B.C.D.Good Sequences题意:从一个递增数字序列中找出一串最长的序列满足任意相邻的数字不互质。分析:The main idea is DP. Let's definedp[x]as the maximal value of the length of the good sequence whose last element isx, and defined[i]as the (maximal value ofdp[x]wherexis divisible byi).You should calculatedp[x]in the increasing order of
阅读全文
摘要:A.Games题意:有n个球队,两个之间会有比赛,每个球队有主场和客场的衣服并且颜色不同,当在自己主场比赛时,如果对方衣服和主场衣服颜色一样,就要穿客场衣服,问最多有多少场这样的情况。分析:直接暴力。View Code #include <stdio.h>#include <string.h>int h[33], a[33];int main(){ int n,i, j; while (scanf("%d",&n)!=EOF) { for (i=0; i<n; i++) scanf("%d %d",&h[i]
阅读全文
摘要:A.Fancy Fence题意:判断一个角是不是正多边形的内角。分析:如果 60<=d<180 &&360%(180-n)==0 就是符合的内角。View Code #include <stdio.h>#include <math.h>#include <string.h>int main(){ int t; int n; scanf("%d",&t); while (t--) { scanf("%d",&n); if (n<180 && n>=6
阅读全文


浙公网安备 33010602011771号