ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

HELP
Posted by chez 26 Feb 2006 14:43
Problem 1022
Here is my code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int k, s, r[120], a, max, re=-1;
char t[20000];

int main(){
scanf("%d", &k);
gets(t);
for(int l=0; l<k; l++){
gets(t);
a=(strlen(t)/2);
r[l]=a;
}

for(int j=0; j<k; j++){
for(int i=0; i<k; i++)
if(re<r[i]){
re=r[i];
max=i;
if(max<s)
for(int u=s+1; u<k; u++)
if(re<=r[u]){
re=r[u];
max=u;
}
}

r[max]=-1;
s=max;
re=-1;
printf("%d ",max+1);
}

return 0;
}


It does not pass the 4-th test. I don't know what this test is. If someone want to join me to solve problems, contact with me via ICQ: 270-822

============================================================

The message is translated by moderator. Dear chez, use English to post your messages here. And is prohibited to post the code to this board. An exception was made for you as a beginner. But the code will be deleted after several days.

Edited by moderator 26.02.2006 20:13