0
About Average word length it get right in test 1, 2, 4 but the other is no what problem with code?
5 odpowiedzi
+ 1
round up is done with ceil() not round().
the difference is:
round(3.1) = 3
round(3.6) = 4
ceil(3.1) = 4
ceil(3.6) = 4
so change round to ceil.
and skip '?' in first test-case
if(s[i]=='?')
continue;
if(s[i]!=' ')
c1++;
else
c2++;
cout<<ceil(c1/c2)<<endl;
+ 1
if the test was well written it would not pass.
because of ceil()
the 2nd test-case. has 34 characters if you count "..." and 31 if you skip them.(with " " skipped )
there are 7 words in any case.
so:
34 / 7 = 4.xx
31/ 7 = 4.xx
with ceil() you get 5 every time. so it doesn't matter if you skip them or not. unlike "?" in first case which gives different results if you don't skip it.
0
Why I didn't skip '.'
0
Thanks for effort 💜sorry I exhausted you
0
no problem, mar7aba.