codeforces #294(Div 2) A、B、C

来源:互联网 发布:淘宝兼职招聘网 编辑:程序博客网 时间:2024/05/22 13:51

题目A: A and B and chess

#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>#include <cstdlib>#include <vector>#include <queue>#include <cmath>#define LL long long using namespace std;int main(){char ch;int w = 0, b = 0;for(int i=1;i<=8;i++){for(int j=1;j<=8;j++){cin>>ch;if(ch == 'Q') w += 9;else if(ch == 'R') w += 5;else if(ch == 'B') w += 3;else if(ch == 'N') w += 3;else if(ch == 'P') w += 1;else if(ch =='q') b += 9;else if(ch == 'r') b += 5;else if(ch == 'b') b += 3;else if(ch == 'n') b += 3;else if(ch == 'p') b += 1;}}if(w > b) cout<<"White"<<endl;else if(w < b) cout<<"Black"<<endl;else cout<<"Draw"<<endl;return 0
题目B : A and B and Compilation errors

#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>#include <algorithm>#include <vector>#include <cmath>#include <queue>#include <set>#include <map>#define LL long long using namespace std;const int MAXN = 100000 + 10;map<int,int>mm1,mm2,mm3;int N;int A[MAXN];int main(){scanf("%d", &N);for(int i=1;i<=N;i++) {scanf("%d", &A[i]);mm1[A[i]]++;}int x;for(int i=1;i<=N-1;i++){scanf("%d", &x);mm2[x]++;}for(int i=1;i<=N-2;i++){scanf("%d", &x);mm3[x]++;}for(int i=1;i<=N;i++) if(mm1[A[i]] != mm2[A[i]]){printf("%d\n", A[i]);break;}for(int i=1;i<=N;i++) if(mm2[A[i]] != mm3[A[i]]){printf("%d\n", A[i]);break;}return 0;}
题目C A and B and Team Trainning

#include <iostream>#include <cstring>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cmath>using namespace std;int main(){int n , m;cin>>n>>m;cout<<min(min(n,m),(n+m)/3)<<endl;return 0;}


0 0
原创粉丝点击