Codeforces 228 div2 A,B,C
来源:互联网 发布:淘宝广告位价格表 编辑:程序博客网 时间:2024/05/16 06:23
全水题。。。。。
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int num[1200],n;int gcd(int a,int b){return b==0?a:gcd(b,a%b);}int main(){scanf("%d",&n);int a=-1;for(int i=0;i<n;i++) {scanf("%d",&num[i]);if(a==-1) a=num[i];else a=gcd(a,num[i]);}printf("%d\n",a*n);return 0;}
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int n,nb;char g[1000][1000];bool ck(int x,int y){if((x>=0&&x<n)&&(y>=0&&y<n)) return true;return false;}void dfs(int x,int y){if(ck(x+1,y)&&ck(x+2,y)&&ck(x+1,y-1)&&ck(x+1,y+1)){if(g[x][y]=='#'&&g[x+1][y]=='#'&&g[x+1][y-1]=='#'&&g[x+1][y+1]=='#'&&g[x+2][y]=='#'){g[x][y]=g[x+1][y]=g[x+1][y-1]=g[x+1][y+1]=g[x+2][y]='X';nb+=5;}}}int main(){scanf("%d",&n);for(int i=0;i<n;i++){scanf("%s",g[i]);}int jinghao=0;for(int i=0;i<n;i++){for(int j=0;j<n;j++){if(g[i][j]=='#') jinghao++;}}if(jinghao%5) {puts("NO"); return 0;}for(int i=0;i<n;i++){for(int j=0;j<n;j++){if(g[i][j]=='#'){dfs(i,j);}}}if(nb!=jinghao){puts("NO");}else{puts("YES");}return 0;}
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int st[1000],n,ans=0;int vis[1000];int main(){scanf("%d",&n);for(int i=0;i<n;i++) scanf("%d",st+i);sort(st,st+n);for(int i=0;i<n;i++){if(vis[i]==0){ans++;int strength=1;vis[i]=ans;for(int j=i+1;j<n;j++){if(vis[j]) continue;if(st[j]>=strength){vis[j]=ans;strength++;}} }}printf("%d\n",ans);return 0;}
0 0
- Codeforces 228 div2 A,B,C
- codeforces 239 (div2) A B C D
- codeforces 208(div2) A+B+C+D
- Codeforces Rounds #254 div2:A,B,C
- codeforces 260 div2 A,B,C
- Codeforces Round #278(Div2) A B C
- codeforces #285 div2 *A B *C
- codeforces 250 div2 A B C D
- Codeforces Round #432 div2 A+B+C
- codeforces#336 div2 A,B
- Codeforces Round#229 DIV2 A,B,C,D
- codeforces RCC2014 Warmup div2 A+B+C+D+E
- Codeforces Round#258 div2 A B C (Problemset 451)
- codeforces#259 div2 (a,b,c)三题
- codeforces round # 273 div2 A, B, C题题解
- codeforces Round #377 div2 A B C(数学推导)
- Codeforces Round #434 div2 A, B , C,D 题 题解
- cf_290(div2)A,B,C
- OCP-1Z0-053-200题-128题-281
- 各种常用的JSON接口
- ch和sh的音标
- 编写一个方法,返回某集合的所有子集。
- java 死锁
- Codeforces 228 div2 A,B,C
- prime算法--布线问题
- Android4.0不能在主线程中进行HTTP请求
- windows 设置环境变量
- SRM 586
- 一位蜗牛程序员六年工作总结-2013
- ural 1310 数位dp
- Zorin OS 7 及日常办公软件安装笔记
- OCP-1Z0-053-200题-127题-154答案貌似都不对?