Uva 621:Secret Research

Problem Link


A hard tiring problem !Many loopholes,many many,use http://www.udebug.com

<Source Code>

#include<stdio.h>
#include<string.h>
int main()
{
char a[10000];int n,t,l,i;
scanf(“%d%*c”,&t);
i=1;while(t–)
{l=0;
gets(a);
l=strlen(a);

if(a[0]==’9′ && a[l-1]==’4′)
printf(“*\n”);
else if((a[0]==’1’&&l==1||(l==1 && a[0]==’4′)))
printf(“+\n”);
else if(a[l-2]==’3′ &&a[l-1]==’5′)
printf(“-\n”);
else if((a[0]==’1’&&a[l-1]==’1′)||(a[0]==’1’&&a[l-1]==’4′)||(a[0]==’1’&&a[l-2]==’7’&&a[l-1]==’8′))
printf(“?\n”);
else if(a[l-2]==’7′ &&a[l-1]==’8′)
{
if(l==2)
printf(“+\n”);
else
printf(“?\n”);
}
else if(a[l-1]==’4’||a[l-1]==’1′)
{
if(a[0]==’1′ ||a[0]==’4′)
printf(“?\n”);
else
printf(“+\n”);

}
else if(a[0]==’1’&&a[1]==’9’&&a[l-1]!=’4’&&a[l-1]!=’8’&&a[l-1]!=’1’&&a[l-1]!=’5′)
printf(“?\n”);

}
return 0;
}

Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s