#16712: 不用陣列的方法


terhead8775 (terhead8775)

學校 : 國立內壢高級中學
編號 : 87826
來源 : [36.227.66.229]
最後登入時間 :
2020-10-07 01:16:08
d985. Gran Turismo 5 -- 學姊 | From: [140.138.145.128] | 發表日期 : 2019-02-01 11:55

#include <iostream>
using namespace std;
int main()
{
int N, total = 0, test = 0, best = 0;
while(cin >> N)
{
for(int a = 0 ; a < N ; a++)
{
int M;
cin >> M;
for(int b = 0 ; b < M ; b++)
{
int minute , second ;
cin >> minute >> second ;
total = total + 60 * minute + second;
test = 60 * minute + second;
if(test < best)
{
best = test ;
}
else if(best == 0)
{
best = test ;
}
}
cout << "Track " << a + 1 << ':' << endl;
cout << "Best Lap: " << best/60 << " minute(s) " << best%60 << " second(s)." << endl;
cout << "Average: " << total/60/M << " minute(s) " << total/M%60 << " second(s)." << endl;
total = 0;
best = 0;
}
}
return 0;
}

 
ZeroJudge Forum