1657
来源:互联网 发布:java 循环查询数据库 编辑:程序博客网 时间:2024/05/14 19:50
#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define Max 20
using namespace std;
struct student
{
int grade;
char name[Max];
}s[105];
bool compare(const student s1, const student s2)
{
if (s1.grade > s2.grade)
return true;
else if(s1.grade== s2.grade)
{
if(strcmp(s1.name,s2.name)>0)
return false;
else return true;
}
else return false;
}
int main()
{
int T;
while(~scanf("%d",&T))
{
for(int i=0;i<T;i++)
cin>>s[i].name>>s[i].grade;
sort(s,s+T,compare);
for(int i=0;i<T;i++)
cout<<s[i].name<<' '<<s[i].grade<<endl;
}
return 0;
}
#include<cstring>
#include<cstdio>
#include<algorithm>
#define Max 20
using namespace std;
struct student
{
int grade;
char name[Max];
}s[105];
bool compare(const student s1, const student s2)
{
if (s1.grade > s2.grade)
return true;
else if(s1.grade== s2.grade)
{
if(strcmp(s1.name,s2.name)>0)
return false;
else return true;
}
else return false;
}
int main()
{
int T;
while(~scanf("%d",&T))
{
for(int i=0;i<T;i++)
cin>>s[i].name>>s[i].grade;
sort(s,s+T,compare);
for(int i=0;i<T;i++)
cout<<s[i].name<<' '<<s[i].grade<<endl;
}
return 0;
}
0 0
- 1657
- 1657
- poj 1657
- POJ 1657
- poj 1657
- POJ 1657
- zoj 1657
- ZOJ-1657
- 1657: 求日龄
- zcmu-1657
- 北大1657题
- zoj 1657 hash、、、
- 棋盘距离 1657 poj
- POJ 1657
- Distance on Chessboard 1657
- POJ 1657 解题报告
- 1657-Distance on Chessboard
- POJ 1657解题报告
- Maven使用小记
- 正则表达式基本语法
- UNIX系统下,设置ssh登陆不需要密码
- Linux 中如何安装卸载软件
- Node.js实现网络负载均衡器:LoadBalancer.js
- 1657
- [译]不要开发Apps,开发Superpowers
- java中的管道流PiedOutputStream和PipeInputStream
- linux下修改环境变量文件.bashrc
- app版本更新问题
- LLDB总结
- iOS数据持久化之属性列表和归档
- https证书
- Android ListView从网络获取图片及文字显示