hdu 2115 I Love This Game
来源:互联网 发布:软件白名单 编辑:程序博客网 时间:2024/05/21 20:30
http://acm.hdu.edu.cn/showproblem.php?pid=2115
注意两点:
1:输出格式;
2:结构体排序
#include <iostream>#include <algorithm>#include <cstring>using namespace std;struct sa{ char name[55]; int a; int b; int num; char ch;}data[15];int cmp(sa x,sa y){ if(x.a != y.a) return x.a < y.a; else if(x.b != y.b) return x.b < y.b; else return strcmp(x.name,y.name)<0;}int main(){ int m,cas=1; bool flag=0; while(cin>>m,m) { if(flag) cout<<endl; flag=1; for(int i=0; i<m; i++) cin>>data[i].name>>data[i].a>>data[i].ch>>data[i].b; sort(data,data+m,cmp); cout<<"Case #"<<cas++<<endl; int sum=1; data[0].num=1; for(int i=1; i<m; i++) { if(data[i].a == data[i-1].a && data[i].b == data[i-1].b) data[i].num=sum; else { data[i].num=sum; sum=i+1; data[i].num=i+1; } } for(int i=0; i<m; i++) cout<<data[i].name<<" "<<data[i].num<<endl; } return 0;}
0 0
- hdu 2115 I Love This Game
- HDU 2115 I Love This Game
- HDU 2115 I Love This Game
- hdu 2115 I Love This Game
- hdu 2115 I Love This Game
- I Love This Game hdu 2115
- HDU 2115 I Love This Game
- hdu 2115 I Love This Game
- HDU--2115 I Love This Game
- hdu 2115 I Love This Game
- hdu-2115-I Love This Game
- hdu 2115 I Love This Game
- HDU 2115 I Love This Game
- I Love This Game 2115
- hdu-2115(结构体,sort) I Love This Game
- HDOJ(HDU) 2115 I Love This Game(排序排序、、、)
- HDU,2215,I Love This Game
- I Love This Game!
- android studio添加三方类库(module)
- linux常用命令
- vs2013中QT信号槽绑定
- difference-in-differences with fixed effects
- 最长公共子序列
- hdu 2115 I Love This Game
- C++对C的函数拓展 - 默认参数
- 1. 为什么选择RTX
- Dubbo源码阅读体会(一)
- Jackson fasterxml和codehaus的区别 (fasterxml vs. codehaus)
- UVA - 10911 Forming Quiz Teams
- Java多线程的基本概述以及创建
- UVa 12589 Learning Vector
- String、CString、char*、int、float、double相互转换