| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 137593 | hjx2115 | 字符串的奇偶性 | C++ | Accepted | 3 MS | 272 KB | 624 | 2025-11-20 19:32:35 |
#include <bits/stdc++.h> using namespace std; int main() { int i,n,s; char a[50]; while (true) { cin>>a; s=0; if (a[0]=='#') break; else { i=0; while (i<strlen(a)) { if (a[i]=='1') s++; i++; } if (s==0 and a[i-1]=='e') a[i-1]='0'; else if (s==0 and a[i-1]=='o') a[i-1]='1'; else if (s%2!=0) { if (a[i-1]=='e') a[i-1]='1'; else a[i-1]='0'; } else { if (a[i-1]=='e') a[i-1]='0'; else a[i-1]='1'; } } cout<<a<<endl; } return 0; }