Codeforces Round #200 (Div. 2)
来源:互联网 发布:java内存溢出解决方法 编辑:程序博客网 时间:2024/06/08 13:40
My submissions
8分钟的时候交A题,编译器选错了,然后刷新又得等好久……
C题RE的原因是输入b为1的情况,会有除0的操作,竟然用了20分钟才发现这个问题……
A题代码
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<string>#include<stack>#include<map>#include<queue>#include<algorithm>using namespace std;int main(){ int n, a, b, res = 0; a = 0 - 1; scanf("%d", &n); while( n-- ) { b = a; scanf("%d", &a); if( a != b) { res++; } } printf("%d\n", res); return 0;}
B题代码
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<string>#include<stack>#include<map>#include<queue>#include<algorithm>using namespace std;int main(){int a, b, c;int aa, bb, cc;scanf("%d %d %d", &a, &b, &c);aa = (b - c + a ) / 2;bb = (c - a + b ) / 2;cc = (a - b + c ) / 2;if( (aa + bb != b) || (bb + cc != c) || (cc + aa != a) || aa < 0 || bb < 0 || cc < 0){printf("Impossible\n");return 0;}printf("%d %d %d", aa, bb, cc);return 0;}
C题代码
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<string>#include<stack>#include<map>#include<queue>#include<algorithm>using namespace std;int main(){__int64 a, b, res = 0, temp;scanf("%I64d %I64d", &a, &b);if(a == b){printf("1\n");return 0;}if( b == 1){printf("%I64d\n", a);return 0;}res += a / b;a %= b;while( a != 1 ){res += b / a;temp = b;b = a;a = temp;a = a % b;}res += b;printf("%I64d\n", res);return 0;}
D题代码
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<string>#include<stack>#include<map>#include<queue>#include<algorithm>using namespace std;char str[100050];int main(){ stack<char>a; scanf("%s", str); int i, l; l = strlen(str); if( l % 2) { printf("No\n"); return 0; } a.push(str[0]); for( i = 1; i < l; i++) { if( a.empty() || str[i] != a.top() ) { a.push(str[i]); } else { a.pop(); } } if( a.empty()) { printf("Yes\n"); return 0; } else { printf("No\n"); } return 0;}
题目都太水了,好多人半小时左右就过了四个题目的……
解体报告就懒得写了,这种题目一看代码就能懂的吧。
- Codeforces Round #200 (Div. 2)
- Codeforces Round #200 (Div. 2)
- Codeforces Round #200 (Div. 2)
- codeforces round 200Div
- Codeforces Round #200 (Div. 2)A. Magnets
- Codeforces Round #200 (Div. 2) (ABCDE题解)
- Codeforces Round #200 (Div. 1)
- Codeforces Round #200 (Div. 1)
- Codeforces Round #200 (Div. 1)
- Codeforces Round #102 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #104 (Div. 2)
- Codeforces Round #105 (Div. 2)
- Codeforces Round #105 (Div. 2)
- Codeforces Round #107 (Div. 2)
- Codeforces Round #108 (Div. 2)
- Codeforces Round #110 (Div. 2)
- mmc一维下料例子
- 华容道
- IOS开发,UINavigationController属性和基本用法详解
- csdn博客开通
- Windows 2008 防火墙开放端口
- Codeforces Round #200 (Div. 2)
- nand_read nand 读数据函数
- 啊啊啊!
- HDU4731+找规律
- JAVA概述(7)运算符
- 《UniDAC 基础》 【菜头】 翻译 (之一)
- CreateSemaphore、OpenSemaphore、ReleaseSemaphore
- Leetcode: Subsets (Iterative)
- UniDAC 基础 英文 原文【就不传其中的图片了】