Home > Back-end >  Run-time error 73% solution!!!!!!
Run-time error 73% solution!!!!!!

Time:04-11

Title description
Small h is doing a survey: your favorite of 10 Numbers from 0 to 9? He asked the personal, tell these people formed a digit integer, then the small h to call his girlfriend, request help to count, which most Numbers appear in the integer,
Enter
Multiple sets of input of a line, each made up of a bit integer

Title guarantee:
O
For each group of input, digital output in the most times (if there are multiple digital occurrences, output the smallest number)
The sample input Copy
1
2
3
Sample output Copy
1
2
3
 # include 
Int main ()
{
Char st [1000];
Int a [10], I, num, place;
While (the scanf (" % s ", st)!=(EOF)
{
for(i=0; i<10; I++)
{
A [I]=0;
}
i=0; Num=0; Place=0;
While (st [I]!='\ 0')
{
The switch (st [I] - '0')
{
Case 0: a [0]=a [0] + 1; break;
Case 1: a [1]=[1] a + 1; break;
Case 2: a [2]=a [2] + 1; break;
Case 3: a [3]=a [3] + 1; break;
Case 4: a [4]=a [4] + 1; break;
Case 5: a [5]=a [5] + 1; break;
Case 6: a [6]=a [6] + 1; break;
Case 7: a [7]=a [7] + 1; break;
Case 8: a [8]=a [8] + 1; break;
Case 9: a [9]=a [9] + 1; break;
}
i++;
}
Num=a, [0].
for(i=0; i<10; I++)
{
If (num>=a [I + 1])
{num=num; Place=place; }
The else
{num=a [I + 1); Place=I + 1; }
}
Printf (" % d \ n ", place);
}
return 0;
}


  • Related