|
|
back to boardWA test 4 help me, please! #include <iostream> using namespace std; int main() { int n, i, j; cin>>n; int a[n], s=0, s1=0, s2=0, s3=0, s4=0, s5=0, s6=0, s7=0, s8=0, s9=0, s10=0; for(i=1; i<=n; i++) cin>>a[i]; for(i=1; i<=n; i++) { if(a[i]==1) s1++; if(a[i]==2) s2++; if(a[i]==3) s3++; if(a[i]==4) s4++; if(a[i]==5) s5++; if(a[i]==6) s6++; if(a[i]==7) s7++; if(a[i]==8) s8++; if(a[i]==9) s9++; if(a[i]==10) s10++; //if(a[i]==0) s++;
} if(s1==0) cout<<""; else cout<<s1<<" "<<"1 "; if(s2==0) cout<<""; else cout<<s2<<" "<<"2 "; if(s3==0) cout<<""; else cout<<s3<<" "<<"3 "; if(s4==0) cout<<""; else cout<<s4<<" "<<"4 "; if(s5==0) cout<<""; else cout<<s5<<" "<<"5 "; if(s6==0) cout<<""; else cout<<s6<<" "<<"6 "; if(s7==0) cout<<""; else cout<<s7<<" "<<"7 "; if(s8==0) cout<<""; else cout<<s8<<" "<<"8 "; if(s9==0) cout<<""; else cout<<s9<<" "<<"9 "; if(s10==0) cout<<""; else cout<<s10<<" "<<"10 "; cout<<endl; "<<s8<<" 8 "<<s9<<" 9 "<<s10<<" 10 "; } Re: WA test 4 help me, please! Posted by Cawa222 21 Jul 2013 15:01 твоя прога не пройдет тест 1 1 2 2 2 1 1 1 |
|
|