2013年7月8日 星期一

d985: Gran Turismo 5

http://zerojudge.tw/ShowProblem?problemid=d985


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**********************************************************************************/
/*  Problem: d985 "Gran Turismo 5" from 學姊                                    */
/*  Language: CPP (827 Bytes)                                                     */
/*  Result: AC(4ms, 404KB) judge by this@ZeroJudge                                */
/*  Author: jrsh0906 at 2013-07-09 13:50:17                                       */
/**********************************************************************************/


/*
 Author: Hsu Shih Po
 Date: 09/07/13 13:50
 Description: d985: Gran Turismo 5
*/
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
 int N = 0,M = 0;
 
 cin>>N;
 
 for(int a = 1;a <= N;a++)
 {
  cin>>M;
  
  int min = 0,sec = 0;
  
  cin>>min>>sec;
  
  int best_time = 0;
  
  best_time = min*60 + sec;
  
  int avg_time = best_time;
  
  for(int b = 1;b < M;b++)
  {
   cin>>min>>sec;
   
   int time = min*60 + sec;
   
   if(time < best_time)
    best_time = time;
    
   avg_time += time;  
  }
  
  avg_time /= M;
  
  cout<<"Track "<<a<<":"<<endl;
  cout<<"Best Lap: "<<best_time/60<<" minute(s) "<<best_time%60<<" second(s).\n";
  cout<<"Average: "<<avg_time/60<<" minute(s) "<<avg_time%60<<" second(s).\n";
  cout<<endl;
 }
 
 return 0;
}

沒有留言:

張貼留言