|
|
back to boardTo admins: There are no more than 1000 words in the file? Posted by Макс 6 Dec 2006 22:06 I know that it is stupid to read all strings and then process them, instead of reading one - processing it, reading next, processing it and so on. But I coded as wrote before(read all and then solve) I created int r[1024][1024], because in the task there is written that "There are no more than 1000 words in the file", and size of each is no more than 1001(initially is 1000, but with one inserted symbol...). I got Crash(access violation), I guessed that maybe I addressed inaccessible memory. I updated my code and replaced it by this: char r[1024][1024]; string s; cin>>n; m = 0; cin>>s; while (!(cin.eof())){ if (m > 1000) continue; if (s.size()>n+1) return; if (s.size()<n-1) return; strcpy(r[m++],s.c_str()); len[m-1] = strlen(r[m-1]); cin>>s; } and got TL test 3. So it was, I think, because of if (m > 1000) continue; then I made int r[3000][1024] and got AC )) why? maybe there is more than 1000 words in the file? Yes, there are about 2000 words in test 3 (-) Re: Yes, there are about 2000 words in test 3 (-) Posted by svr 7 Dec 2006 22:50 It,s unfair! One year I have been thinking that "I too stupid to solve this problem" Firstly we are supplied with onest information and immediately have Ac simply increased sizez of arrays. I think there are not fewer than 10-15 such problem's statements with errors. |
|
|