📄 1305.cpp
字号:
/* This Code is Submitted by wywcgs for Problem 1305 on 2005-03-20 at 08:09:13 */
#include <stdio.h>
#include <string.h>
typedef struct{
char name[81];
int problemSloved;
int penaltyPoints;
}Team;
void teamcpy(Team*, Team*);
int main()
{
Team MAX, temp;
int teamNum, slvTimes, petPoints;
int i, j;
while(scanf("%d", &teamNum) == 1){
for(i = 0; i < teamNum; i++){
temp.problemSloved = 0;
temp.penaltyPoints = 0;
scanf("%s", temp.name);
for(j = 0; j < 4; j++){
scanf("%d %d", &slvTimes, &petPoints);
if(petPoints != 0){
temp.problemSloved++;
temp.penaltyPoints += (slvTimes - 1) * 20 + petPoints;
}
}
if(i == 0){
teamcpy(&MAX, &temp);
}else{
if(MAX.problemSloved < temp.problemSloved){
teamcpy(&MAX, &temp);
}else if((MAX.problemSloved == temp.problemSloved) && (MAX.penaltyPoints > temp.penaltyPoints)){
teamcpy(&MAX, &temp);
}
}
}
printf("%s %d %d\n", MAX.name, MAX.problemSloved, MAX.penaltyPoints);
}
return 0;
}
void teamcpy(Team* dest, Team* src)
{
dest->problemSloved = src->problemSloved;
dest->penaltyPoints = src->penaltyPoints;
strcpy(dest->name, src->name);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -