I think you must use scanf("\n"); instead of fflush(stdin); because maybe fflush(stdin) doesn't work in judge compiler.
![:o](./images/smilies/icon_eek.gif)
GOOD LUCK...
Moderator: Board moderators
Code: Select all
12
yich liny Uf Uutput cUntiinK i Kingly uppyrciKy lyttyr, x
fUllUwyd by i Kingly Kpicy, thyn fUllUwyd by i pUKitivy dycimil intygyr.
Thy intygyr indicityK hUw miny timyK thy cUrryKpUnding lyttyr ippyirK in thy input tyxt.
Uppyr ind lUwyr ciKy lyttyrK in thy input iry tU by cUnKidyryd thy Kimy.
NU Uthyr chirictyrK muKt by cUuntyd. q
Thy Uutput muKt by KUrtyd in dyKcynding cUunt Urdyr; thit iK,
thy mUKt fryquynt lyttyr iK Un thy firKt Uutput liny,
ind thy liKt liny Uf Uutput indicityK thy lyiKt fryquynt lyttyr. vVvV
If twU lyttyrK hivy thy Kimy fryquyncy,
thyn thy lyttyr which cUmyK firKt in thy ilphibyt muKt ippyir firKt in thy Uutput.
If i lyttyr dUyK nUt ippyir in thy tyxt,
xXthyn thit lyttyr muKt nUt ippyir in thy Uutput. xQQ
[EOF]
Code: Select all
3
= 1 + 2 = 2 + 1 = -9 + 12
= 18 * ( 1 / 6 ) = -3 * -1
= 16^(1 / 2) - 1 = ???.......
[EOF]
Code: Select all
Y 97
T 88
I 71
U 58
N 40
K 34
R 34
H 29
P 24
L 23
C 18
D 16
F 12
M 11
B 6
G 6
Q 6
V 6
W 6
X 6
[EOF]
Code: Select all
[EOF]
Oh...Jemerson wrote:i got the same answer of yours, also tested a few worse cases but still got WA, dont know what to do..
Try check again for above description.The next n lines will contain zero or more characters
Code: Select all
6
x
x
x
x
Below line is a blank line. This is checking for input itself.
If your input part was wrong, it may read this line .... thanks.
Code: Select all
I 8
E 5
L 5
N 5
S 4
X 4
T 3
A 2
B 2
C 2
F 2
H 2
K 2
O 2
G 1
P 1
R 1
U 1
W 1
Code: Select all
I 13
N 9
T 8
A 7
E 7
S 7
L 6
R 5
H 4
O 4
X 4
F 3
K 3
P 3
U 3
W 3
B 2
C 2
G 2
Y 2
D 1
M 1
Code: Select all
int main()
{
int n;
long long int s[27];
char c;
int i,j;
while(cin>>n)
{
i=0; j=0;
for(j=0;j<27;j++)
s[j]=0;
while(i<n)
{
c=getchar();
if(c=='\n')
i++;
else
{
if(c>='A'&&c<='Z')
{
j = c - 65;
s[j] = s[j] + 1;
}
if(c>='a'&& c<='z')
{
j = c - 97;
s[j] = s[j] + 1;
}
}
}
int max,k,temp;
char ch;
for(j=0;j<26;j++)
{
max =0;
for(k=0;k<26;k++)
{
if(s[k]>max)
{
max = s[k];
temp = k;
}
}
ch = temp + 'A';
s[temp]=0;
if(max!=0)
cout<<ch<<" "<<max<<"\n";
}
}
return 0;
}[quote]i get wrong answer every time i submit it.sumbody please help me with sample input output or justs tell me wat is wrong with my code[/quote]