|
|
back to boardWA 1 Please,help!My program out 3 in example,maybe,as in a test #1,but i have WA! # include <string.h> # include <iostream.h> #include <stdio.h> int main() { char a[100][31]; int b[100]; int N,i,j,k,h,counter; cin>>N; counter=0; if (0<=N && 1000>=N) { for (i=0;i<N;i++) { cin.getline(a[i],1000); //j++; cin>>a[i][j]; b[i]=1; } for (i=0;i<N;i++) { b[i]=0; for (j=i;j<N;j++) if ((strcmp(a[i],a[j])==0)&&(b[j]==1)) { counter++; b[j]=0; } } //printf("%d\n",counter); counter++; cout<<counter<<endl; } return 0; } Re: WA 1 Hey read carefully instead of: char a[100][31]; write char a[1001][31]; |
|
|