【题目链接】:http://codeforces.com/problemset/problem/190/C

【题意】



让你根据去掉标点符号的;

pair 以及 int这两种类型;

确定出一种类型;

使得它能够存得下n个int;

输入数据保证有n个int;

【题解】



每一个f()调用以后,就要输入一种类型;

如果没有输入进来;则,无解;

输入进来了;

则根据这个输入进来的类型;

如果是pair,则需要再输入两个类型,调用两次f();

答案字符串加上那些被省略的标点;

如果输入完一个类型之后,还有输入;

也应该输出无解;

(给的n是没用的)



【Number Of WA】



0



【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0),cin.tie(0) typedef pair<int,int> pii;
typedef pair<LL,LL> pll; const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110; string s,ans; void wujie(){
cout <<"Error occurred"<<endl;
exit(0);
} void f(){
if (cin>>s){
ans+=s;
if (s=="pair"){
ans+='<';f();ans+=',';f();ans+='>';
}
}
else
wujie();
} int main(){
//Open();
Close();//scanf,puts,printf not use
//init??????
cin >> s;
f();
if (cin>>s)
wujie();
else
cout << ans <<endl;
return 0;
}

【codeforces 190C】STL的更多相关文章

  1. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  2. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  3. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  4. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  5. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  6. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

  7. 【Codeforces 429D】 Tricky Function

    [题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...

  8. 【Codeforces 670C】 Cinema

    [题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...

  9. 【codeforces 515D】Drazil and Tiles

    [题目链接]:http://codeforces.com/contest/515/problem/D [题意] 给你一个n*m的格子; 然后让你用1*2的长方形去填格子的空缺; 如果有填满的方案且方案 ...

随机推荐

  1. CF786A - Berzerk

    /* CF786A - Berzerk http://codeforces.com/contest/786/problem/A 博弈论 直接搜出NP状态图.记得要记忆化剪枝. * */ #includ ...

  2. 去哪网实习总结:如何配置数据库连接(JavaWeb)

    本来是以做数据挖掘的目的进去哪网的,结构却成了系统开发.. . 只是还是比較认真的做了三个月,老师非常认同我的工作态度和成果. .. 实习立即就要结束了.总结一下几点之前没有注意过的变成习惯和问题,分 ...

  3. struts自己定义拦截器--登录权限控制

    说明:该自己定义的拦截器实现用户登录的权限控制. login.jsp--->LoginAction--重定向-->MainAction--->main.jsp 一.1.整体的步骤: ...

  4. Error: CompareBaseObjectsInternal can only be called from the main thread

    Posted: 01:39 PM 06-17-2013 hi, we're working on a project where we need to do some calculations on ...

  5. ios Button

    展现效果例如以下: 功能说明: 1加入来图片背景, 2动态展现百度网页, 3动态加入button. 4展现提示框.展现你点击提示框得index  我成功来你也快来试试. 1 详细得项目创建与拖动but ...

  6. Codeforces 425A Sereja and Swaps(暴力枚举)

    题目链接:A. Sereja and Swaps 题意:给定一个序列,能够交换k次,问交换完后的子序列最大值的最大值是多少 思路:暴力枚举每一个区间,然后每一个区间[l,r]之内的值先存在优先队列内, ...

  7. apiCloud中的数据库操作mcm-js-sdk的使用

    1.引入js <!-- 引入mcm-js-sdk Begin --> <script type="text/javascript" src="../pl ...

  8. Pocket英语语法---六、感官动词接不同的动词表示什么意思

    Pocket英语语法---六.感官动词接不同的动词表示什么意思 一.总结 一句话总结:其实进行时一般是表示连续,动词原形一般表示常态,过去分词一般表示被动(或者完成). 感官动词接原型表示动作的一般情 ...

  9. 【IOI 2011】Race

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2599 [算法] 点分治 [代码] #include<bits/stdc++.h ...

  10. angular4父组件向子组件传值,子组件向父组件传值的方法

    父组件向子组件传值   @Input 文件目录 父组件: father.template.html <h1>父组件</h1> <cmt-child [data]='dat ...