简单排序。

  1. #include<cstdio>
  2. #include<cstring>
  3. #include<cmath>
  4. #include<vector>
  5. #include<map>
  6. #include<stack>
  7. #include<queue>
  8. #include<string>
  9. #include<iostream>
  10. #include<algorithm>
  11. using namespace std;
  12.  
  13. struct X
  14. {
  15. string s;
  16. string c;
  17. int g;
  18. }p[];
  19. int n;
  20.  
  21. bool cmp(const X&a,const X&b)
  22. {
  23. return a.g>b.g;
  24. }
  25.  
  26. int main()
  27. {
  28. scanf("%d",&n);
  29. for(int i=;i<=n;i++)
  30. cin>>p[i].s>>p[i].c>>p[i].g;
  31. sort(p+,p++n,cmp);
  32.  
  33. int flag=;
  34. int L,U; scanf("%d%d",&L,&U);
  35. for(int i=;i<=n;i++)
  36. {
  37. if(p[i].g>=L&&p[i].g<=U)
  38. {
  39. cout<<p[i].s<<" "<<p[i].c<<endl;
  40. flag=;
  41. }
  42. }
  43. if(flag==) printf("NONE\n");
  44. return ;
  45. }

PAT (Advanced Level) 1083. List Grades (25)的更多相关文章

  1. 【PAT甲级】1083 List Grades (25 分)

    题意: 输入一个正整数N(<=101),接着输入N个学生的姓名,id和成绩.接着输入两个正整数X,Y(0<=X,Y<=100),逆序输出成绩在x,y之间的学生的姓名和id. tric ...

  2. PTA(Advanced Level)1083.List Grades

    Given a list of N student records with name, ID and grade. You are supposed to sort the records with ...

  3. PAT (Advanced Level) 1114. Family Property (25)

    简单DFS. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...

  4. PAT (Advanced Level) 1109. Group Photo (25)

    简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...

  5. PAT (Advanced Level) 1105. Spiral Matrix (25)

    简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<map> #incl ...

  6. PAT (Advanced Level) 1101. Quick Sort (25)

    树状数组+离散化 #include<cstdio> #include<cstring> #include<cmath> #include<map> #i ...

  7. PAT (Advanced Level) 1071. Speech Patterns (25)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  8. PAT (Advanced Level) 1063. Set Similarity (25)

    读入之后先排序. 询问的时候可以o(m)效率得到答案. #include<cstdio> #include<cstring> #include<cmath> #in ...

  9. PAT (Advanced Level) 1059. Prime Factors (25)

    素因子分解. #include<iostream> #include<cstring> #include<cmath> #include<algorithm& ...

随机推荐

  1. Ansible3:ansible.cfg配置说明【转】

    Ansible默认安装好后有一个配置文件/etc/ansible/ansible.cfg,该配置文件中定义了ansible的主机的默认配置部分,如默认是否需要输入密码.是否开启sudo认证.actio ...

  2. mysql日志详细解析【转载】

    转自:http://pangge.blog.51cto.com/6013757/1319304 MySQL日志: 主要包含:错误日志.查询日志.慢查询日志.事务日志.二进制日志: 日志是mysql数据 ...

  3. Redis如何保存数组和对象

    个人建议使用PHP自带的序列化函数serialize和unserialize函数 我们可以封装一个自己的Redis类 <?php class MyRedis{ private static $h ...

  4. winxp sp2

    不支持sha2,所以ssl建立失败, sp3就可以了 http://superuser.com/questions/802693/sha2-support-for-windows-xp-sp2-any ...

  5. C#获取本机局域网ip和公网ip

    1.获取局域网ip IPAddress ipAddr = Dns.Resolve(Dns.GetHostName()).AddressList[0];//获得当前IP地址 string ip=ipAd ...

  6. EL表达式处理字符串 是否 包含 某字符串 截取 拆分...............

    EL表达式处理字符串 是否 包含 某字符串 截取 拆分............... JSP页面页头添加<%@ taglib uri="/WEB-INF/taglib/c.tld&qu ...

  7. Android OpenGL ES(九)绘制线段Line Segment .

    创建一个DrawLine Activity,定义四个顶点: float vertexArray[] = { -0.8f, -0.4f * 1.732f, 0.0f, -0.4f, 0.4f * 1.7 ...

  8. IMP指针

    可能大家一直看到有许多朋友在Runtime相关文章中介绍IMP指针的概念,那么IMP究竟有什么实际作用呢?让我们先从一个函数看起来. Method Swizzling 如果对Runtime有一定了解的 ...

  9. UIKit控件直接显示网页文字内容

    NSString *html = @"<bold>Hello</bold> Now<br> <em>iOS</em> can cr ...

  10. 求n!末尾0的个数

    题目连接 /* £:离散数学. £:n!中2的个数>5的个数. £:2*5=10: */ #include<cstdio> #include<cstring> #incl ...