Codeforces Gym 100286I iSharp 模拟
原题地址:http://codeforces.com/gym/100286/attachments/download/2013/20082009-acmicpc-northeastern-european-regional-contest-neerc-08-en.pdf
题意大概就是让你把写在一块的变量分开。。水题,用string过。
详见代码:
//#include<iostream> #include<fstream> #include<string> #include<algorithm> using namespace std;string s; string allType; string va,ty; string Analyze(string v) {int t = 0;while ((v[t] >= 'A' && v[t] <= 'Z') || (v[t] >= 'a' && v[t] <= 'z'))t++;va.assign(v.begin(), v.begin() + t);ty.assign(v.begin() + t, v.end());reverse(ty.begin(), ty.end());return ty + " " + va + ";"; }string a;int main() {ifstream cin("isharp.in");ofstream cout("isharp.out");cin.sync_with_stdio(false);getline(cin, s);int tmp = 0;while (s[tmp] != ' ')tmp++;allType.assign(s.begin(), s.begin() + tmp);tmp++;while (true) {int t = tmp;while (s[t] != ',' && s[t] != ';')t++;a.assign(s.begin() + tmp, s.begin() + t);a = allType + Analyze(a);int c = 0;for (int i = 0; i < a.length(); i++) {if (a[i] == '[' || a[i] == ']') {c++;if (c % 2)cout << '[';else cout << ']';}else cout << a[i];}cout << endl;if (s[t] == ';')break;tmp = t + 2;}return 0; }
转载于:https://www.cnblogs.com/HarryGuo2012/p/4713933.html
Codeforces Gym 100286I iSharp 模拟相关推荐
- Codeforces Gym 100286I iSharp 水题
Problem I. iSharp Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest ...
- Codeforces Gym 101173 CERC 16 D BZOJ 4790 Dancing Disks
Codeforces Gym 101173 CERC 16 D & BZOJ 4790 Dancing Disks 强烈安利这道构造题目,非常有意思. 这里用到的思想是归并排序! 多路归并排序 ...
- Codeforces Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven)
Codeforces Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven) 题目来源: Codeforces 题意: 给出一些比赛, ...
- [Codeforces Gym 101651/100725B] Banal Tickets
Codeforces Gym 100725 题解: 先分两种情况, 积为000与积非0" role="presentation" style="position ...
- Codeforces Gym 101158 E. Infallibly Crack Perplexing Cryptarithm (模拟 + 语法分析)
AC代码 C++版本 /* 根据 定义的等式 的规则 判断给定串可以写成多少种二进制等式且成立的形式解法: 通过语法分析的形式将多个表达式定义进行 递归下降的解析. 此方法可以不用过多考虑多种表达式定 ...
- Codeforces Gym 2015 ACM Arabella Collegiate Programming Contest
比赛链接: http://codeforces.com/gym/100676 题目链接: http://codeforces.com/gym/100676/attachments/download/3 ...
- Codeforces Gym 100513G G. FacePalm Accounting 暴力
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...
- Codeforces Gym 100269 Dwarf Tower (最短路)
题目连接: http://codeforces.com/gym/100269/attachments Description Little Vasya is playing a new game na ...
- Codeforces Gym 100676G Training Camp 状压dp
http://codeforces.com/gym/100676 题目大意是告诉你要修n门课,每门课有一个权值w[i], 在第k天修该课程讲获得k*w[i]的学习点数,给出了课程与先修课程的关系,要修 ...
最新文章
- 大学老师吐血自白:指导学生写论文真是太太太太太难了!
- unix环境高级编程-线程(2)
- 机器学习 不均衡数据的处理方法
- 暗通道先验去雾实现过程分析
- 200行代码写一个简易的dva
- linux创建脚本文件auto,linux 自动化部署脚本
- Github图片无法打开的问题解决【2020.07.20更新】
- govendor用法
- 的优先级大小_cache也有优先级
- python3标识符_python3学习笔记一(标识符、关键字)
- 普中28335开发攻略_TMS320F28335项目开发记录5_28335之CCS编程基础
- 二等分计算机打印机尺寸,电脑打印纸三种等分是什么尺寸
- mysql cmd 关闭防火墙_MySQL WorkBench:Failed to Connect to MySQL at XXX.XXX.XXX with user XXX
- 目标跟踪技术及其数据集
- 数论复习之费马与欧拉
- 【四】头歌平台实验-确定性推理
- 软件测试原书第二版(佩腾著)-学习笔记(一)
- qt 设置背景图片、背景色步骤
- 关于代码审查的一些探讨和总结
- 中国剩余定理扩展中国剩余定理 入门详解