ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1230. Introspective Program

Why I got WA????????????
Posted by kingfisher 19 Mar 2003 19:34
#include<stdio.h>

void main()
{printf("#include<stdio.h>\n");
printf("#include<string.h>\n");
printf("\n");
printf("#define max 32001\n");
printf("\n");
printf("char s[max],note[26][max];\n");
printf("\n");
printf("void work()\n");
printf("{\n");
printf("  int len,i,j,k,start,stop,ll;\n");
printf("  char t,tt,temp[max];\n");
printf("  len=s[0];t=s[1];t=t-65;k=strlen(note[t]);\n");
printf("  for(i=0;i<max;i++)temp[i]=0;\n");
printf("  for(i=0;i<k;i++)temp[i]=note[t][i];\n");
printf("  for(i=0;i<max;i++)note[t][i]=0;\n");
printf("  i=2;ll=0;\n");
printf("  while(s[i]==32)i++;while(s[i]!=61)i++;i++;\n");
printf("  while(i<len)\n");
printf("  {\n");
printf("    while(s[i]==32)i++;\n");
printf("    if((s[i]>64)&&(s[i]<91))\n");
printf("      {tt=s[i]-65;\n");
printf("       if(tt!=t)\n");
printf("     {k=strlen(note[tt]);for(j=0;j<k;j++){note[t][ll]=note
[tt][j];ll++;}}\n");
printf("       else{k=strlen(temp);\n");
printf("       for(j=0;j<k;j++){note[t][ll]=temp[j];ll++;}}}\n");
printf("    while(s[i]==32)i++;\n");
printf("    if(s[i]==36)\n");
printf("      {while(s[i]==32)i++;\n");
printf("       while(s[i]!=40)i++;i++;tt=s[i];i+=2;\n");
printf("       start=0;while(s[i]==32)i++;\n");
printf("       while(s[i]!=44){start=start*10+s[i]-48;i++;}i++;start--
;\n");
printf("       stop=0;while(s[i]==32)i++;\n");
printf("       while(s[i]!=41){stop=stop*10+s[i]-48;i++;}
i++;stop+=start;\n");
printf("       tt=tt-65;\n");
printf("       for(j=start;j<stop;j++)\n");
printf("       {note[t][ll]=note[tt][j];ll++;}\n");
printf("      }\n");
printf("    while(s[i]==32)i++;\n");
printf("    if(s[i]==34){i++;while(s[i]!=34){note[t][ll]=s
[i];i++;ll++;}}\n");
printf("    while(s[i]==32)i++;\n");
printf("    if(s[i]==39){i++;while(s[i]!=39){note[t][ll]=s
[i];i++;ll++;}}\n");
printf("    i++;\n");
printf("  }\n");
printf("}  \n");
printf("\n");
printf("void out()\n");
printf("{\n");
printf("  int i,j,k,len,start,stop;\n");
printf("  char t;\n");
printf("  i=2;len=s[0];\n");
printf("  while(i<len)\n");
printf("  {\n");
printf("    while(s[i]==32)i++;\n");
printf("    if((s[i]>64)&&(s[i]<91))\n");
printf("      {t=s[i]-65;k=strlen(note[t]);for(j=0;j<k;j++)printf
(\"%");
printf("c\",note[t][j]);}\n");
printf("    while(s[i]==32)i++;\n");
printf("    if(s[i]==36)\n");
printf("      {while(s[i]==32)i++;while(s[i]!=40)i++;i++;t=s
[i];i+=2;\n");
printf("       start=0;while(s[i]==32)i++;\n");
printf("       while(s[i]!=44){start=start*10+s[i]-48;i++;}i++;start--
;\n");
printf("       stop=0;while(s[i]==32)i++;\n");
printf("       while(s[i]!=41){stop=stop*10+s[i]-48;i++;}
i++;stop
Re: Why I got WA????????????
Posted by Evil Cheater 20 Mar 2003 19:43
You should print a program in PIBAS not in C/C++!