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 = ;
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 = ;
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 = ;
for (int i = ; i < a.length(); i++) {
if (a[i] == '[' || a[i] == ']') {
c++;
if (c % )cout << '[';
else cout << ']';
}
else cout << a[i];
}
cout << endl;
if (s[t] == ';')break;
tmp = t + ;
}
return ;
}
Codeforces Gym 100286I iSharp 模拟的更多相关文章
- Codeforces Gym 100286I iSharp 水题
Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- Codeforces Gym 101252D&&floyd判圈算法学习笔记
一句话题意:x0=1,xi+1=(Axi+xi%B)%C,如果x序列中存在最早的两个相同的元素,输出第二次出现的位置,若在2e7内无解则输出-1. 题解:都不到100天就AFO了才来学这floyd判圈 ...
- Codeforces Gym 101190M Mole Tunnels - 费用流
题目传送门 传送门 题目大意 $m$只鼹鼠有$n$个巢穴,$n - 1$条长度为$1$的通道将它们连通且第$i(i > 1)$个巢穴与第$\left\lfloor \frac{i}{2}\rig ...
- Codeforces Gym 101623A - 动态规划
题目传送门 传送门 题目大意 给定一个长度为$n$的序列,要求划分成最少的段数,然后将这些段排序使得新序列单调不减. 考虑将相邻的相等的数缩成一个数. 假设没有分成了$n$段,考虑最少能够减少多少划分 ...
- 【Codeforces Gym 100725K】Key Insertion
Codeforces Gym 100725K 题意:给定一个初始全0的序列,然后给\(n\)个查询,每一次调用\(Insert(L_i,i)\),其中\(Insert(L,K)\)表示在第L位插入K, ...
- Codeforces gym 101343 J.Husam and the Broken Present 2【状压dp】
2017 JUST Programming Contest 2.0 题目链接:Codeforces gym 101343 J.Husam and the Broken Present 2 J. Hu ...
- codeforces gym 100553I
codeforces gym 100553I solution 令a[i]表示位置i的船的编号 研究可以发现,应是从中间开始,往两边跳.... 于是就是一个点往两边的最长下降子序列之和减一 魔改树状数 ...
- CodeForces Gym 100213F Counterfeit Money
CodeForces Gym题目页面传送门 有\(1\)个\(n1\times m1\)的字符矩阵\(a\)和\(1\)个\(n2\times m2\)的字符矩阵\(b\),求\(a,b\)的最大公共 ...
- Codeforces GYM 100876 J - Buying roads 题解
Codeforces GYM 100876 J - Buying roads 题解 才不是因为有了图床来测试一下呢,哼( 题意 给你\(N\)个点,\(M\)条带权边的无向图,选出\(K\)条边,使得 ...
随机推荐
- C#栈Stack的使用
using System; using System.Collections.Generic; namespace CSharp栈 { class Program { static void Main ...
- javaEE(4)_response、request对象
一.简介 Web服务器收到客户端的http请求,会针对每一次请求,分别创建一个用于代表请求的request对象.和代表响应的response对象.request和response对象即然代表请求和响应 ...
- OpenCV2.4.11+VS2012的环境配置+“fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突”的问题解决
本来OpenCV环境配置的问题是个基础问题,但是步骤有点小烦,所以几乎每次都要百度一下,加上这次遇到的“fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突 ...
- c++ 当输入的数据不符合数据类型时,清理输入流
if (!cin) { cin.clear(); while (cin.get() != '\n') continue; cout << "Bad input; input pr ...
- redis:高可用分析
https://www.cnblogs.com/xuning/p/8464625.html 基于内存的Redis应该是目前各种web开发业务中最为常用的key-value数据库了,我们经常在业务中用其 ...
- css3如何实现click后页面过渡滚动到顶部
var getTop = document.getElementById("get-top"); var head = document.getElementById(" ...
- git 常用命令及虚拟机服务器仓库搭建
$ git config --global user.email "you@example.com" $ git config --global user.name "Y ...
- loj2145 「SHOI2017」分手是祝愿
记 \(f_i\) 是从要做 \(i\) 步好操作变成要做 \(i-1\) 步好操作的期望操作次数. 显然 \(f_i=i/n \times 1 + (1-i/n) \times (1 + f_{i+ ...
- python模拟浏览器webdriver登陆网站后抓取页面并输出
关键在于以下两行代码 特别是find_element_by_xpath写法 很多写成 findElementsByXpath不知道是写错了 还是高级版本是这么写的... #webElement = s ...
- 大数据学习——hbase数据库
Hhbase集群搭建 一 第一步 准备:搭建hadoop集群,搭建zookeeper 二 第二步:上传安装包 解压 1 tar -zxvf hbase-1.2.1-bin.tar.gz 重命名 2 ...