<int, double> --> <int, string> 从而避免了输出格式;

 #include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <algorithm>
using namespace std; int main()
{
int t, count = ;
string line1, line2;
int index;
string value;
vector<pair<int, string>> store;
cin >> t;
getchar();
while(t--)
{
getchar();
count ++;
getline(cin, line1);
getline(cin, line2);
stringstream ss1(line1), ss2(line2);
while(ss1 >> index)
{
ss2 >> value;
store.push_back(pair<int, string>(index, value));
}
sort(store.begin(), store.end());
if(count > ) cout << endl;
for(int i = ; i < store.size(); i++)
cout << store[i].second << endl; store.clear();
} return ;
}
 #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
using namespace std; int main()
{
int T;
cin >> T;
while(T--)
{
string str, s;
stringstream ss;
vector<int> ind;
map<int, string> Map; getline(cin, str); // T 后面的\n
getline(cin, str); // 空行 getline(cin, str); // index
ss << str;
while(ss >> s) ind.push_back(stoi(s)); for(int i= ;i < ind.size(); i++)
cin >> str, Map[ind[i]] = str; for(int i = ; i < ind.size(); i++)
cout << Map[i+] << endl;
if(T > )
cout << endl;
}
return ;
} string toString(int I)
{
stringstream ss;
string str;
ss << I;
ss >> str; return str;
}
 // 输入输出是怎么回事???
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map> using namespace std; #define FOI(i, A, B) for(i = A; i <= B; i++)
#define FOD(i, A, B) for(i = A; i >= b; i--) string toString(int I)
{
stringstream ss;
string str;
ss << I;
ss >> str; return str;
} int main()
{
int T;
cin >> T;
string str, s;
while(T--)
{
getline(cin, str);
getline(cin, str);
vector<string> ind, val;
map<string, string> Map;
stringstream ss;
getline(cin, str);
ss << str;
while(ss >> s) ind.push_back(s);
int N = ind.size(), i;
FOI(i, , N-)
{
cin >> str;
Map[ind[i]] = str;
}
FOI(i, , N-)
cout << Map[toString(i+)] << endl;
if(T > )
cout << endl;
}
return ;
}

uva 482 - Permutation Arrays的更多相关文章

  1. UVA 11922 Permutation Transformer(平衡二叉树)

    Description Write a program to transform the permutation 1, 2, 3,..., n according to m instructions. ...

  2. 全排列 UVA 11525 Permutation

    题目传送门 题意:训练指南P248 分析:逆向考虑,比如一个全排列:7345261,它也可以表示成题目中的形式,第一个数字7是由6 * (7 - 1)得到的,第二个数字3有2 * (7 - 2)得到, ...

  3. uva 11922 Permutation Transforme/splay tree

    原题链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18902 伸展树的区间翻转剪切... 如下: #include< ...

  4. UVa 11922 - Permutation Transformer 伸展树

    第一棵伸展树,各种调试模板……TVT 对于 1 n 这种查询我处理的不太好,之前序列前后没有添加冗余节点,一直Runtime Error. 后来加上冗余节点之后又出了别的状况,因为多了 0 和 n+1 ...

  5. uva 11922 - Permutation Transformer

    splay的题: 学习白书上和网上的代码敲的: #include <cstdio> #include <cstring> #include <cstdlib> #i ...

  6. UVA 11922 Permutation Transformer(Splay Tree)

    题目链接: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18902 [思路] 伸展树+打标记. 用伸展树维护这个序列,使得能 ...

  7. UVA 11525 Permutation(树状数组)

    题目意思是说  给你一个数k  然后有k个si   问你1--k 的第n个全排列是多少   注意是 1 2 3...k的全排列 不是si的 N=   由观察得知(k-i)!就是k-i个数字的全排列种数 ...

  8. UVA 11525 Permutation (树状数组+YY)

    题意:给你k个数Si,然后给你一个等式   H= ∑  Si ∗ (K − i)!  (i=(1->k)且0 ≤ Si ≤ K − i). 叫你求出第H个全排列 其实这是一个康托展开:X=a[n ...

  9. UVA - 11922 Permutation Transformer (splay)

    题目链接 题意:你的任务是根据m条指令改变排列{!,2,3,...,n}.每条指令(a,b)表示取出第a~b个元素,翻转后添加到排列的尾部.输出最终序列. 解法:splay对区间分裂合并翻转,模板题. ...

随机推荐

  1. 转:Backbone与Angular的比较

    原文来自于:http://www.infoq.com/cn/articles/backbone-vs-angular 将不同的思想和工具进行对比,是一种更好地理解它们的方式.在本文中,我首先将列举在创 ...

  2. 把 图片 资源文件 编译到dll

    今天盘古 lucene的改了下.然后 里面有很多文件 . 还有一些 生成多音字的 汉语词典等. 索性一下子编译到dll里面 . 就不在项目里面设置 这些文件的目录了 然后找了下.愣是没找到. 后来发现 ...

  3. CentOS 6.5 安装realtek RTL8188CE无线网卡

    首先,要检查一下网络适配器的型号. [root@localhost sam]# lspci -nn | grep -i net03:00.0 Ethernet controller [0200]: R ...

  4. CSS padding margin border属性详解【转载】

    本文转载自:http://www.cnblogs.com/linjiqin/p/3556497.html ,感谢相关博主. 图解CSS padding.margin.border属性 W3C组织建议把 ...

  5. hdu3368之DFS

    Reversi Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Su ...

  6. Java基础知识强化94:Calendar类之Calendar概述和获取日历字段的方法

    1. Calendar类概述:       Calendar 类是一个抽象类,它为特定瞬间与一组诸如 YEAR.MONTH.DAY_OF_MONTH.HOUR 等 日历字段之间的转换提供了一些方法,并 ...

  7. java设计模式---享元模式

    享元模式 顾名思义:共享元对象.如果在一个系统中存在多个相同的对象,那么只需要共享一份对象的拷贝,而不必为每一次使用创建新的对象. 享元模式是为数不多的.只为提升系统性能而生的设计模式.它的主要作用就 ...

  8. linux telnet服务安装与配置

    关闭防火墙:service iptabls stop            chkconfig iptabls off 1.安装telnet服务 [root@rheltest1 ~]# rpm -qa ...

  9. X5SDK 腾讯浏览器内核

    介绍 官网:http://x5.tencent.com/ 文档:http://x5.tencent.com/doc?id=1003  腾讯浏览服务由QQ浏览器团队出品,致力于优化移动端[webview ...

  10. eclipse 库 library jar包 工程 总结

    引用库错误 如果在libraries中发现有小红叉,表明引用库错误 解决办法:在左侧projects中add引用到的库 如:我们的支付库引用了以下三个库 那么需要在projects中add这三个库   ...