Course
来源:互联网 发布:java编程99乘法表 编辑:程序博客网 时间:2024/05/16 06:40
Course
时间限制:1000 ms | 内存限制:65535 KB
难度:2
- 描述
- There is such a policy in Sichuan University that if you are not satisfied with the score of your course, you can study this course again to get a better score. If you do this and get a higher score(than the highest score he got before), it can cover the original one. And we can say this time you update the score of this course successfully.Here is one schoolmate's all the courses he has studied and scores he got (sorted by chronological order). So could you tell me how many time he successfully update his scores of courses?
- 输入
- The first of input is an integer T which stands for the number of test cases. For each test case the first line is an integer N (1 <= N <= 100) which stands for the number of courses he has studied.Then following N lines, each line contains a string (only contains letters and the length is no more than 30,which stands for the course name) and an integer (0<=integer<=100, which stands for the score of the course),separated by a space.
Remember: the best way is getting the best score in one time.
Study one course many times is not a recommended choice! - 输出
- For each test case output the number of times he update successfully.
- 样例输入
26CProgramming 70DataStructrue 80CProgramming 80CProgramming 60CProgramming 90DataStructrue 702CompilerTheory 95Network 90
- 样例输出
20
#include#includetypedef struct Course{ char name[35]; int grade; int flag;}Course;//定义存储结构int main(){ int m,n,i,j,count; Course s[100]; scanf("%d",&m); while(m--){ count=0; scanf("%d",&n); for(i=0;i scanf("%s%d",s[i].name,&s[i].grade); s[i].flag=0;//标志变量初始化 } for(i=0;i for(j=i+1;j if(s[i].flag==1)//如果是已统计过的课程退出 break; if(strcmp(s[i].name,s[j].name)==0){ s[j].flag=1; if(s[i].grade
s[i].grade=s[j].grade; count++; } } } printf("%d\n",count); } return 0;}//一次就过了,第一次啊
0 0
- Course
- course
- 【Course Schedule】Course Schedule
- Course Summarize
- famous course
- course-book
- Train Course
- FPGA course
- MIT course
- good-course
- SD-Course
- Course Schedule
- Course Schedule
- Course Schedule
- Course Schedule
- Course Schedule
- Course Schedule
- Course Schedule
- Struts与Hibernate整合将Session和Transaction放在Filter中
- 蛇形填数
- Pycharm远程连接服务器(windows下远程修改服务器代码)
- Python 模块大全(很详细!)
- 第16周项目2(1-1)-用指针玩字符串
- Course
- HDOJ 题目4465 Candy(快速排列组合)
- Redis研究(三)—字符串类型
- Android中的Animation <set>使用
- 是否可以从一个static方法内部发出对非static方法的调用?
- 子串和
- 水池数目
- 第16周项目2(1-2)-用指针玩字符串
- C语言中容易被忽略的细节(第二篇)