말말말 ¶
이상해
source code ¶
~cpp #include <iostream> using namespace std; #define MAX_OF_TEAM_NUM 100 #define MAX_OF_Q 9 int main() { int case_num; int team_data[MAX_OF_TEAM_NUM+1][MAX_OF_Q+1]; // 0번째 배열은 시간 벌점 다음부터는 int temp_team_num, q_num, q_index[MAX_OF_TEAM_NUM]; // 문제 푼 index int temp_time; int case_count = 0; char moment; int i; // 초기화 for(i = 0; i <= MAX_OF_TEAM_NUM; i++) { q_index[i] = 1; team_data[i][0] = 0; for(int j = 1; j <= MAX_OF_Q; j++) team_data[i][j] = -1; } cin >> case_num; // case num while(case_count < case_num) { while(1) { cin >> temp_team_num; if(temp_team_num == 0) // case 끝은 0으로 break; cin >> q_num; cin >> temp_time; cin >> moment; if(moment == 'C') { team_data[temp_team_num][0] += temp_time; team_data[temp_team_num][q_index[temp_team_num]] = q_num; // 문제번호 넣기 q_index[temp_team_num]++; } else if(moment == 'I') { team_data[temp_team_num][0] += 20; team_data[temp_team_num][q_index[temp_team_num]] = q_num; } else { } case_count++; } } // print for(i = 1; i <= MAX_OF_TEAM_NUM; i++) { if(team_data[i][0] != 0) { cout << "team number : " << i << endl; cout << "team num of q : " << q_index[i] << endl; cout << "team time : " << team_data[i][0] << endl; } } return 0; }