| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 160550 | 字符串的奇偶性 | C++ | Wrong Answer | 1 MS | 276 KB | 562 | 2026-09-22 19:58:37 |
#include <bits/stdc++.h> using namespace std; int main() { string s; while (cin>>s){ if (s[0]=='#'){ break; }int ones=0; for(int i=0;i<s.length()-1;i++){ if(s[i]=='1'){ ones++; } }char c=s[s.length()-1]; if (c == 'e') { if (ones % 2 == 0) cout << "even" << endl; else cout << "odd" << endl; } else { if (ones % 2 == 1) cout << "odd" << endl; else cout << "even" << endl; } } return 0; }
------Input------
1010101010101010101010101011010o 0101010101010101010101001010101e 111111111111e 11111e 111111111111o 11111o 000000000000e 00000e 000000000000o 00000o 111100001010101011010e 10010011010010101111111111o 111111111111111100o 00000000000000111e 1100110011001010101101010e 101010101010100101010101o 1110101010100010101010e 1010101011010101010o 1010101010101010o 10101010010101010e #
------Answer-----
10101010101010101010101010110101 01010101010101010101010010101011 1111111111110 111111 1111111111111 111110 0000000000000 000000 0000000000001 000001 1111000010101010110101 100100110100101011111111110 1111111111111111001 000000000000001111 11001100110010101011010101 1010101010101001010101011 11101010101000101010101 10101010110101010101 10101010101010101 101010100101010100
------Your output-----
even odd even odd even odd even even even even odd odd even odd odd even odd even even even