#4512: 非常感謝指導已可run 但 第25個測資錯誤


wwww (米豆)

學校 : 不指定學校
編號 : 12713
來源 : [175.180.100.52]
最後登入時間 :
2010-11-30 23:05:43
b255. D. 跑跑卡丁車 -- 2009 NPSC 高中組決賽 | From: [175.180.100.77] | 發表日期 : 2010-11-09 01:18

非常感謝指導
已可run 但出現 第25個測資錯誤
 
#include <iostream>
#include <cstdlib>

using namespace std;

struct world
{
      string name;           // 隊名 
      int score;          // 排名時數 
} ; 
    
typedef struct world snd;     // 定義資料型態名稱--排名 

bool cmp(snd a,snd b){

     if(a.score<b.score ) return 1;
     return 0;/*0表示要交換*/
}

int main(void){  
      
      int n=0;
      while( cin >> n ){
         if ( n==0 ) { break; }
         snd s[n];
         string tot;
         int hh=0,mm=0,ss=0,ms=0;
         for(int i=0;i<n;i++){
             cin >>s[i].name>>tot;
             hh= atoi(tot.substr(0,2).c_str())*3600000 ; 
             mm= atoi(tot.substr(3,2).c_str())*60000 ;
             ss= atoi(tot.substr(6,2).c_str())*1000 ;
             s[i].score=hh+mm+ss;
             if ( tot.length()>10 ) {
                  s[i].score+= atoi(tot.substr(9,tot.length()-9).c_str());
             }   
             
         }
             
          sort(s,s+n,cmp);    //排序   
   
          cout<<"LIST START"<<endl;
          int k=0;
          k=n/3;
          for(int i=0;i<k;i++){
              cout <<s[i].name<<endl;
          }
          for(int i=k;i<n;i++){
              if ( s[k-1].score == s[i].score ) {
                   cout <<s[i].name<<endl;
              }     
          } 
    cout<<"LIST END"<<endl;
          

    }     
//system("pause");
return 0;

}
 
#4513: Re:非常感謝指導已可run 但 第25個測資錯誤


asas (向諸神與地雷醬獻上祈禱)

學校 : 不指定學校
編號 : 5185
來源 : [36.228.104.72]
最後登入時間 :
2024-03-06 23:29:54
b255. D. 跑跑卡丁車 -- 2009 NPSC 高中組決賽 | From: [124.218.23.53] | 發表日期 : 2010-11-09 02:24

比賽時,也是有部分的人錯再和你一樣的地方~~
再次看清楚輸出說明!!(有部分題目要仔細看清題目~~)
 
ZeroJudge Forum