Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
问一下,OLE是怎么回事?(用scanf就OLE,用cin就AC)cin的AC代妈: #include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { string c; while(cin >> c){ //char c[260]; //if(scanf("%s", c) == 0) break; int len = c.length(); int pos = 0; int tobe = 1; for(; pos < len; pos ++){ char cc = c[pos]; if(cc == 'N') { ; } else if(cc == 'C' || cc == 'D' || cc == 'E' || cc == 'I') { tobe++; } else if(cc >= 'p' && cc <= 'z') { tobe--; } else break; if(tobe <= 0) break; } if(pos == len - 1 && tobe == 0) cout << "YES" << endl; else cout << "NO" << endl; } return 0; } scanf的OLE代妈: #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { while(1){ char c[260]; if(scanf("%s", c) == 0) break; int len = strlen(c); int pos = 0; int tobe = 1; for(; pos < len; pos ++){ char cc = c[pos]; if(cc == 'N') { ; } else if(cc == 'C' || cc == 'D' || cc == 'E' || cc == 'I') { tobe++; } else if(cc >= 'p' && cc <= 'z') { tobe--; } else break; if(tobe <= 0) break; } if(pos == len - 1 && tobe == 0) cout << "YES" << endl; else cout << "NO" << endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator