Page 2 of 2

Posted: Wed Jun 13, 2007 4:45 pm
by hamedv
What's wrong with my code!!!

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

int t, l, i, len, M, E, x, y, z;
char s[1001];
bool b;

int main()
{
scanf("%d", &t);
for (l = 0; l < t; l++)
{
scanf("%s", &s);
b = 1;
M = 0;
E = 0;
len = strlen(s);
for (i = 0; i < len; i++)
{
if (s != '?' && s != 'M' && s != 'E') b = 0;
if (s == 'M') M++;
if (s == 'E') E++;
}
if (M != 1) b = 0;
if (E != 1) b = 0;
i = 0;
len = strlen(s);
x = 0;
while ((s == '?') && (i < len)) i++, x++;
if (x == 0) b = 0;
if (s == 'M') i++; else b = 0;
y = 0;
while ((s == '?') && (i < len)) i++, y++;
if (y == 0) b = 0;
if (s == 'E') i++; else b = 0;
z = 0;
while ((s == '?') && (i < len)) i++, z++;
if (z == 0) b = 0;
if (z > 0 && x > 0 && y > 0 && M == 1 && E == 1) b = 1;
if (b)
puts("theorem");
else
puts("no-theorem");
}
return 0;
}

Posted: Wed Jun 13, 2007 5:22 pm
by rio
Use previous posted IO tests.
Your code doesn't output correct with the first posted IO test.

----
Rio

Posted: Wed Jun 13, 2007 5:36 pm
by hamedv
thanx

Re: 11203 - Can you decide it for ME?

Posted: Mon Mar 02, 2009 12:07 pm
by deadangelx
the hint is

Code: Select all

M is only one
E is only one
x is at least 1 '?'
y is at least 1 '?'
z is at least 2 '?'
y.length == (z.length - x.length)
Hope is helps.

Re: 11203 - Can you decide it for ME?

Posted: Sun Aug 30, 2009 2:38 pm
by vahid sanei
x + y == z :o
i can`t find this point in the problem


i should guess that ????

Re: 11203 - Can you decide it for ME?

Posted: Wed Jun 13, 2012 7:47 am
by mahade hasan
cut>>>After AC!!

Re: 11203 - Can you decide it for ME?

Posted: Mon Jun 30, 2014 1:49 pm
by uDebug
Here's some input / output I found useful during testing / debugging.

Input:

Code: Select all

9
???????????ME????
?????M?E?????????
?????M??E?????????
?????M?E??????
??M?E???
??M??E???
??ME???
??M???E?????
????M???E?????
AC Output:

Code: Select all

no-theorem
no-theorem
no-theorem
theorem
theorem
no-theorem
no-theorem
theorem
no-theorem