Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

想請問一下關於1028

Posted by leeraphael at 2009-12-22 16:35:36
各位好
想請問一下我的code哪裡有問題,因為我個人放在我的主機上跑都沒有問題,放上去server後,卻出現Wrong Answer。
先謝謝大家
以下是我的code

 15 int main()
 16 {
 17     char str[STACK_SIZE][40];
 18     char input_str[40];
 19     char addr[40];
 20     int fp=-1;
 21     int top=0;
 22     fp++;
 23     strcpy(str[fp],"http://www.acm.org/");
 24
 25
 26     while(scanf("%s", input_str)==1)
 27     {
 28         if(!strcmp(input_str,"BACK"))
 29         {
 30             if(fp-1!=-1)
 31             {
 32                 fp--;
 33                 printf("%s\n",str[fp]);
 34             }
 35             else
 36                 printf("Ignored\n");
 37         }
 38         else if(!strcmp(input_str,"FORWARD"))
 39         {
 40             if(fp+1<=top)
 41             {
 42                 fp++;
 43                 printf("%s\n",str[fp]);
 44             }
 45             else
 46                 printf("Ignored\n");
 47         }
 48         else if(!strcmp(input_str,"VISIT"))
 49         {
 50             scanf("%s", addr);
 51             fp++;
 52             top=fp;
 53             strcpy(str[fp],addr);
 54             printf("%s\n",str[fp]);
 55         }
 56         else if(!strcmp(input_str,"QUIT"))
 57         {
 58             break;
 59         }
 60     }
 61     return 0;
 62 }

執行結果
[leeraphael@embedded 12:47 1028]$./main
VISIT http://acm.ashland.edu/
http://acm.ashland.edu/
VISIT http://acm.baylor.edu/acmicpc/
http://acm.baylor.edu/acmicpc/
BACK
http://acm.ashland.edu/
BACK
http://www.acm.org/
BACK
Ignored
FORWARD
http://acm.ashland.edu/
VISIT http://www.ibm.com/
http://www.ibm.com/
BACK
http://acm.ashland.edu/
BACK
http://www.acm.org/
FORWARD
http://acm.ashland.edu/
FORWARD
http://www.ibm.com/
FORWARD
Ignored
QUIT
[leeraphael@embedded 12:48 1028]$

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator