T.1047.编程团体赛
来源:互联网 发布:武工队后勤部淘宝 编辑:程序博客网 时间:2024/05/18 03:55
送分题,基本上没难度,边输入边将队伍的总分进行统计。然后排序,取最高分即可。
#include<stdio.h>main(){int max(int a[], int len){ int i; int maxid = 0; for ( i=1; i<len; i++) { if ( a[i] > a[maxid]){ maxid = i; } } return maxid;} int i,n; int team1[1001]={0},sum[1001]={0},list[1001]={0}; int team,coder,score; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d-%d %d",&team,&coder,&score); sum[team] += score; } for(i=1;i<=1000;i++){ list[i]=sum[i]; } for ( i=1000; i>0 ; i--) { int maxid = max(sum,i+1); //swap a[maxid], a[len-1] int t = sum[maxid]; sum[maxid] = sum[i]; sum[i] =t; } for(i=1;i<=1000;i++){ if (list[i]==sum[1000]){ printf("%d %d",i,list[i]); break; } } return 0;}
0 0
- T.1047.编程团体赛
- PAT 1047. 编程团体赛
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 1047. 编程团体赛
- 1047. 编程团体赛
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 1047. 编程团体赛
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 1047. 编程团体赛(20)
- 关于 回调 的一些理解(以jdbctemplate为例)
- 关于一个sql注入注入题目的思考
- Kinetis FTM的PWM、输入捕获、正交解码
- 算法训练 装箱问题(0-1背包)
- 设计模式之中介者设计模式n
- T.1047.编程团体赛
- mybatis 配置文件configuration environments以及单独使用mybatis的demo
- String、StringBuffer、与StringBuilder的区别
- 你还在为移动端选择器而捉急吗?【原创】
- 【DP入门】单调递增子序列(二)
- 69道Spring面试题和答案
- qt QLayout: Attempting to add QLayout "" to MainWindow "", which already has a layout. 错误
- [Leetcode] 17. Letter Combinations of a Phone Number
- [nginx] location定位