11203 - Can you decide it for ME?

All about problems in Volume 112. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

hamedv
Learning poster
Posts: 98
Joined: Mon May 07, 2007 8:30 am

Post by hamedv » Wed Jun 13, 2007 4:45 pm

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;
}

User avatar
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Post by rio » Wed Jun 13, 2007 5:22 pm

Use previous posted IO tests.
Your code doesn't output correct with the first posted IO test.

----
Rio

hamedv
Learning poster
Posts: 98
Joined: Mon May 07, 2007 8:30 am

Post by hamedv » Wed Jun 13, 2007 5:36 pm

thanx

deadangelx
New poster
Posts: 32
Joined: Tue Feb 13, 2007 1:31 pm

Re: 11203 - Can you decide it for ME?

Post by deadangelx » Mon Mar 02, 2009 12:07 pm

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.

User avatar
vahid sanei
Learning poster
Posts: 84
Joined: Fri Jan 09, 2009 4:37 pm
Location: IRAN

Re: 11203 - Can you decide it for ME?

Post by vahid sanei » Sun Aug 30, 2009 2:38 pm

x + y == z :o
i can`t find this point in the problem


i should guess that ????
Impossible says I`m possible

User avatar
mahade hasan
Learning poster
Posts: 87
Joined: Thu Dec 15, 2011 3:08 pm
Location: University of Rajshahi,Bangladesh

Re: 11203 - Can you decide it for ME?

Post by mahade hasan » Wed Jun 13, 2012 7:47 am

cut>>>After AC!!
we r surrounded by happiness
need eyes to feel it!

User avatar
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11203 - Can you decide it for ME?

Post by uDebug » Mon Jun 30, 2014 1:49 pm

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
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

Post Reply

Return to “Volume 112 (11200-11299)”