标签:fine print 传送门 iostream printf problem tar char ref
终于过了这sb题了。
当初我连这道题都A不了(╯▔皿▔)╯
#include <cstdio> #include <iostream> #define N 1000001 #define abs(x) ((x) < 0 ? -(x) : (x)) int n = 1, sum1, sum2; char s[N]; int main() { int i; while(std::cin >> s[n]) if(s[n] == ‘E‘) break; else n++; n--; for(i = 1; i <= n; i++) { s[i] == ‘W‘ ? sum1++ : sum2++; if((sum1 >= 11 && abs(sum1 - sum2) >= 2) || (sum2 >= 11 && abs(sum1 - sum2) >= 2)) { printf("%d:%d\n", sum1, sum2); sum1 = sum2 = 0; } } printf("%d:%d\n", sum1, sum2); sum1 = sum2 = 0; puts(""); for(i = 1; i <= n; i++) { s[i] == ‘W‘ ? sum1++ : sum2++; if((sum1 >= 21 && abs(sum1 - sum2) >= 2) || (sum2 >= 21 && abs(sum1 - sum2) >= 2)) { printf("%d:%d\n", sum1, sum2); sum1 = sum2 = 0; } } printf("%d:%d\n", sum1, sum2); return 0; }
标签:fine print 传送门 iostream printf problem tar char ref
原文地址:http://www.cnblogs.com/zhenghaotian/p/7078906.html