|
|
вернуться в форумwa #3 helppppppp pls Послано h1ci 1 дек 2009 02:03 whats wrong could you send some tests pls if you want source I'll give it Re: wa #3 helppppppp pls Послано h1ci 1 дек 2009 02:14 CODE: #include <iostream> #include <string> #include <map> using namespace std; map<string, int> a; int main() { int n,j; cin >> n; string s,s1; int min=0, max=0; cin.ignore(); for(int i=0; i<n; i++) { getline(cin,s); j=0; while(s[j]!=' ') { j++; } s1=s.substr(0,j+1); if(s[s.size()-1]=='C' && s[s.size()-2]=='A'){ if(a[s1]!=1 && a[s1]!=3) {max++; if(a[s1]!=2) a[s1]=1; else a[s1]=3;}}
else if(s[s.size()-1]=='E' && s[s.size()-2]=='C'){ if(a[s1]!=1 && a[s1]!=3) {max++;if(a[s1]!=2) a[s1]=1; else a[s1]=3;}}
else if(s[s.size()-1]=='7'){ if(a[s1]!=1 && a[s1]!=3) {max++;if(a[s1]!=2) a[s1]=1; else a[s1]=3;} if(a[s1]!=2 && a[s1]!=3) {min++;if(a[s1]!=1) a[s1]=2; else a[s1]=3;}} else if(s[s.size()-1]=='6'){ if(a[s1]!=1 && a[s1]!=3) {max++;if(a[s1]!=2) a[s1]=1; else a[s1]=3;}} else continue; } cout << min << ' ' << max << endl; return 0; } Re: wa #3 helppppppp pls Have you ever heard about codestyle and code formatting? No offence, but the chance that one will read such your code is minimal. Anyway, your fault is in CE decisions. Just try: > 1 > h1ci CE The answer should be: > 0 0 |
|
|