Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

问一下,OLE是怎么回事?(用scanf就OLE,用cin就AC)

Posted by KatrineYang at 2016-07-16 23:03:36 on Problem 1126
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator