边读入,边处理,不需要保存数据

 

#include<cstdio>
#include<cstring>
char name[100],sname[100];
int main(){
    int n,score,maxn=-1;
    scanf("%d",&n);
    for (int i=1;i<=n;i++){
        scanf("%d%s",&score,name);
        if (score>maxn) {
            maxn=score;
            strcpy(sname,name);
        }
    }
    printf("%s",sname);
    return 0;
}
View Code

相关文章:

  • 2021-12-08
  • 2022-12-23
  • 2022-02-23
  • 2022-12-23
  • 2021-09-28
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案