網頁

2014年2月13日 星期四

UVa 12667 Last Blood

想法:
  1. 輸入
  2. 如果WA->回到1.
  3. 如果已經AC->回到1.
  4. 更新problem[]資料



#include <iostream>
#include <string>
//#include <cstdio>
using namespace std;
struct team_type{
bool problem_AC[13] = {0};
}team[101];
struct problem_type{
int time;
int team_ID = 0;
}problem[15];
int main()
{
ios::sync_with_stdio(false);
// freopen ("input.txt","rt",stdin);
int n, t, m;
cin >> n >> t >> m;
int time, ID;
string problem_name, state;
for (int i = 0; i < m; i++){
cin >> time >> ID >> problem_name >> state;
if (state != "Yes") continue;
int index = problem_name[0]-'A';
if (team[ID].problem_AC[index] == false){
team[ID].problem_AC[index] = true;
problem[index].time = time;
problem[index].team_ID = ID;
}
}
for (int i = 0; i < n; i++){
if (problem[i].team_ID != 0)
cout << char(i+'A') << ' ' << problem[i].time << ' '
<< problem[i].team_ID << endl;
else
cout << char(i+'A') << " - -" << endl;
}
return 0;
}

沒有留言:

張貼留言