Automated Judge Script

來源:互聯網
上載者:User
 
5. Automated Judge Script成績: 10 / 折扣: 0.8The Problem

眾所周知,編程競賽的裁判們都是又吝嗇又懶的。現在,我們這些裁判又在想如何少幹些事情的同時多找幾個 Wrong Answer 出來!所以,我們想讓你幫我們寫一個自動判分程式,來判斷來自世界各地的團隊所編寫的程式是否正確。你需要編寫的部分是接收標準答案和某團隊的程式所輸出的結果,並且判斷此結果應是“Accepted”、“Presentation Error”還是“Wrong Answer”。其含義如下:

Accepted:由於我們是非常吝嗇的,只有那些和標準答案完全相同(所有的字元都一樣)的結果才能被“Accepted”。

Presentation Error:如果所有的數字字元是相符(包括順序)的且至少有一個非數字字元不符那麼就屬於“Presentation Error”。例如,“15 0”和“150”,就屬於“Presentation Error”,而“15 0”和“1 0”就是“Wrong Anwser”。

Wrong Answer:如果團隊程式的輸出不屬於上面兩類,那就是“Wrong Answer”了。

The Input

輸入中包含很多組資料,每一組資料的第一行是一個整數 n (n < 100),它表示後面的標準答案有多少行。接下來的 n
行是標準答案。再往下的一行又是一個整數 m (m < 100),它表示某團隊提交的程式的輸出有多少行。接下來的 m
行是某團隊的程式的輸出。

當 n = 0 時輸入結束。輸入中的每一行都不超過 120 個字元。

The Output

針對每一組輸入,輸出下面某一行:

Run #x: AcceptedRun #x: Presentation ErrorRun #x: Wrong Answer

其中 x 表示是第幾組輸入(從 1 開始)。

Note

原本應該寫在一行的內容寫到兩行上但內容相同,屬於 PE。

Source

2001 Universidade do Brasil (UFRJ). Internal Contest Warmup 2001.

#include<stdio.h>#include<string.h>main(){  int m,n,i,k=0,j,t;   char correct[100][121],test[200][121],s[121],number[2][121];   while( scanf("%d",&n) && n!=0 )     {  getchar();k++;t=0;for( i=0; i<n; i++ )  { gets(correct[i]);    j=0;    while(correct[i][j]!='\0'){ if( correct[i][j]>='0'&&correct[i][j]<='9' )number[0][t++]=correct[i][j];  j++;}  }number[0][t]='\0';scanf("%d",&m);getchar();t=0;for( i=0; i<m; i++)  {   gets(test[i]);      j=0;      while(test[i][j]!='\0'){ if( test[i][j]>='0'&&test[i][j]<='9' )number[1][t++]=test[i][j];  j++;}  }number[1][t]='\0';if( !strcmp(number[0],number[1]) ){  if(m==n){  for( i=0; i<n; i++)if( strcmp(correct[i],test[i]) ){   printf("Run #%d: Presentation Error\n",k);    break;}   if(i==n) printf("Run #%d: Accepted\n",k);}   else  printf("Run #%d: Presentation Error\n",k);}else printf("Run #%d: Wrong Answer\n",k);     }}

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.