HDU 5702 Solving Order (水题,排序)
题意:给定几种不同的颜色和它的权值,按它的权值排序。
析:排序。
代码如下:
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
using namespace std ;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f3f;
const double eps = 1e-8;
const int maxn = 1000 + 5;
const int dr[] = {0, 0, -1, 1};
const int dc[] = {-1, 1, 0, 0};
int n, m;
struct node{
string s;
int id;
bool operator < (const node &p) const{
return p.id < id;
}
};
vector<node> v; int main(){
int T; cin >> T;
while(T--){
scanf("%d", &n);
v.clear();
node u;
for(int i = 0; i < n; ++i){
cin >> u.s >> u.id;
v.push_back(u);
}
sort(v.begin(), v.end());
for(int i = 0; i < v.size(); ++i)
if(!i) cout << v[i].s;
else cout << " " << v[i].s;
cout << endl;
}
return 0;
}
HDU 5702 Solving Order (水题,排序)的更多相关文章
- HDU 5702 Solving Order
http://acm.hdu.edu.cn/showproblem.php?pid=5702 Problem Description Welcome to HDU to take part in th ...
- HDU 4593 H - Robot 水题
H - RobotTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...
- HDOJ(HDU) 1859 最小长方形(水题、、)
Problem Description 给定一系列2维平面点的坐标(x, y),其中x和y均为整数,要求用一个最小的长方形框将所有点框在内.长方形框的边分别平行于x和y坐标轴,点落在边上也算是被框在内 ...
- HDU 4950 Monster (水题)
Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ...
- HDU 4813 Hard Code 水题
Hard Code Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...
- HDOJ/HDU 2560 Buildings(嗯~水题)
Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ...
- HDU - 1716 排列2 水题
排列2 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submis ...
- HDU—2021-发工资咯(水题,有点贪心的思想)
作为杭电的老师,最盼望的日子就是每月的8号了,因为这一天是发工资的日子,养家糊口就靠它了,呵呵 但是对于学校财务处的工作人员来说,这一天则是很忙碌的一天,财务处的小胡老师最近就在考虑一个问题:如果每 ...
- HDOJ/HDU 2561 第二小整数(水题~排序~)
Problem Description 求n个整数中倒数第二小的数. 每一个整数都独立看成一个数,比如,有三个数分别是1,1,3,那么,第二小的数就是1. Input 输入包含多组测试数据. 输入的第 ...
随机推荐
- 淘宝主搜索离线集群完成Hadoop 2
淘宝搜索离线dump集群(hadoop&hbase)2013进行了几次重大升级,本文中将这些升级的详细过程.升级中所遇到的问题以及这些问题的解决方案分享给大家.至此,淘宝主搜索离线集群完全进入 ...
- python - 简明 性能测试
简洁测试: # python -m cProfile test.py 代码注入: # -*- coding: utf-8 -*- class test(object): pass class test ...
- Myeclipse提示失效?
- dede栏目调用大全
A:侧边栏常用的当前栏目的父栏目调用(5.7) 1.在include/common.inc.php增加函数 function getTopCategoryName($cid=0) { global $ ...
- php 文件file常用的操作
多是代码形式呈现,更多的信息可以查看php api文档,搜索Filesystem; //创建文件夹 $path_find = AppRoot . '/Temp/excel_curl'; //查找的路径 ...
- ORACLE 中KILL session
我们知道,在Oracle数据库中,可以通过kill session的方式来终止一个进程,其基本语法结构为: alter system kill session 'sid,serial#' ; 被kil ...
- 用VS2010打开vs2008
用VS2010打开vs2008,对应的9.0.0.0版本,而应该该使用版本10.0.0.0 解决方案:修改配置文件.将Microsoft.ReportViewer的版本为9.0.0.0改为10.0.0 ...
- java web项目导入问题
由于工作问题,接触到很多其他人的项目,有时候想要直接跑起来,还是需要一定的耐力. 1:导入不进去,干脆新建项目,一个个复制进去: 2:第三方jar包不要忘记,核实jdk j2ee的版本,编译路径 ...
- C++调试 输出数组内容和数组名
#include <cstdio> using namespace std; //函数定义 #define printArr(arr,n,format) \ printf("%s ...
- org-mode
org-mode 编辑 目录 1简介 2扩展 1简介编辑 Org-模式(Org-mode)是文本编辑软件Emacs的一种支持内容分级显示的编辑模式.这种模式支持写 to-do 列表,日志管 ...