=== ContestScoreBoard/신재동 === {{{~cpp #include using namespace std; const int MAX_TEAM = 100; struct team { bool isJoin; int totalScore; int totalSolveProblem; }; team teams[MAX_TEAM]; void initTeams() { for(int i = 0; i < MAX_TEAM; i++) { teams[i].isJoin = false; teams[i].totalScore = 0; teams[i].totalSolveProblem = 0; } } char testLine[5][20] = { "1 2 10 I", "3 1 11 C", "1 2 19 R", "1 2 21 C", "1 1 25 C" }; void input() { int teamNumber; int problemNumber; int solveTime; char solveType; int max_line = 20; char line[20]; cin.getline(line, max_line); //int i = 0; //strcpy(line, testLine[i++]); while(strcmp(line,"")) { teamNumber = atoi(strtok(line, " ")) - 1; problemNumber = atoi(strtok(NULL, " ")) - 1; solveTime = atoi(strtok(NULL, " ")); solveType = strtok(NULL, " ")[0]; teams[teamNumber].isJoin = true; if(solveType == 'C') { teams[teamNumber].totalSolveProblem++; teams[teamNumber].totalScore += solveTime; } else if(solveType == 'I') teams[teamNumber].totalScore += 20; cin.getline(line, max_line); //strcpy(line, testLine[i++]); } } void output() { for(int i = 0; i < MAX_TEAM; i++) { if(teams[i].isJoin) { int teamNumber = i + 1; cout << teamNumber << " " << teams[i].totalSolveProblem << " " << teams[i].totalScore << endl; } } } int main() { initTeams(); input(); output(); return 0; } }}} ---- 테스트 케이스 넣는 건 귀찮아서 뺌. 한편 나름대로 테스트 먼저 만듬. --재동 ---- [ContestScoreBoard]