Problem Type : Ad hoc
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#define MAX 1000
int main()
{
char ch[MAX],des[MAX],ch1[MAX],des1[MAX];
int i,j,len1,len2,test,cas=0,k,p;
scanf("%d",&test);
getchar();
while(test--)
{
cas++;
memset(ch,'\0',sizeof(ch));
gets(ch);
gets(des);
len1=strlen(ch);
len2=strlen(des);
if(strcmp(ch,des)==0)
{
printf("Case %d: Yes\n",cas);
}
else
{
k=0;
for(i=0; i<len1; i++)
{
if(isalpha(ch[i])||isdigit(ch[i]))
{
ch1[k]=ch[i];
k++;
}
}
ch1[k]='\0';
p=0;
for(i=0; i<len2; i++)
{
if(des[i]>='A'&&des[i]<='Z'||des[i]>='a'&&des[i]<='z' || des[i]>='0' &&des[i]<='9')
{
des1[p]=des[i];
p++;
}
}
des1[p]='\0';
if(strcmp(ch1,des1)==0)
{
printf("Case %d: Output Format Error\n",cas);
}
else
{
printf("Case %d: Wrong Answer\n",cas);
}
}
}
}
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#define MAX 1000
int main()
{
char ch[MAX],des[MAX],ch1[MAX],des1[MAX];
int i,j,len1,len2,test,cas=0,k,p;
scanf("%d",&test);
getchar();
while(test--)
{
cas++;
memset(ch,'\0',sizeof(ch));
gets(ch);
gets(des);
len1=strlen(ch);
len2=strlen(des);
if(strcmp(ch,des)==0)
{
printf("Case %d: Yes\n",cas);
}
else
{
k=0;
for(i=0; i<len1; i++)
{
if(isalpha(ch[i])||isdigit(ch[i]))
{
ch1[k]=ch[i];
k++;
}
}
ch1[k]='\0';
p=0;
for(i=0; i<len2; i++)
{
if(des[i]>='A'&&des[i]<='Z'||des[i]>='a'&&des[i]<='z' || des[i]>='0' &&des[i]<='9')
{
des1[p]=des[i];
p++;
}
}
des1[p]='\0';
if(strcmp(ch1,des1)==0)
{
printf("Case %d: Output Format Error\n",cas);
}
else
{
printf("Case %d: Wrong Answer\n",cas);
}
}
}
}
No comments:
Post a Comment