codeforces gym 100286 I iSharp (字符串模拟)
给定一个字符串。输入是int& a*[]&, b, c*;
输出是
int&&[]* a;
int& b;
int&* c;
输入格式里逗号后面一定有个空格,把字母后面的符号逆序拿到前面来,按每个逗号分隔输出即可。
注意输出格式一定是定义类型+符号+空格+字母或字符串+分号。
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
char s[];
char c[],cnt1=;
int main()
{
freopen("isharp.in","r",stdin);
freopen("isharp.out","w",stdout);
while(gets(s))
{
memset(c,,sizeof(c));
int len=strlen(s);
for(int i=;i<len;i++)
{
if(s[i]!=' ')
c[i]=s[i];
else
{
cnt1=i;
break;
}
}
//cout<<c<<endl;;
int ss=cnt1+;
int ee=-;
for(int i=cnt1+;i<len;i++)
{
if(s[i]!=','&&s[i]!=';')
continue;
else
{
ee=i-;
cout<<c;
for(int j=ee;j>=ss;j--)
{
if(!((s[j]>='a'&&s[j]<='z')||(s[j]>='A'&&s[j]<='Z')))
{
if(s[j]!=']')
printf("%c",s[j]);
else
{
printf("[]");
j--;
}
}
else
{
bool first=true;
for(int k=ss;k<=j;k++)
{
if(!((s[k]>='a'&&s[k]<='z')||(s[k]>='A'&&s[k]<='Z')))
printf("%c",s[k]);
else if(first)
{
printf(" %c",s[k]);
first=false;
}
else
printf("%c",s[k]);
}
printf(";\n");
ss=ee+;
i+=;
break;
}
}
}
}
}
return ;
}
// int& a*[]&, b, c*;
codeforces gym 100286 I iSharp (字符串模拟)的更多相关文章
- Codeforces Gym 100338B Spam Filter 字符串哈希+贝叶斯公式
原题链接:http://codeforces.com/gym/100338/attachments/download/2136/20062007-winter-petrozavodsk-camp-an ...
- codeforces 723B Text Document Analysis(字符串模拟,)
题目链接:http://codeforces.com/problemset/problem/723/B 题目大意: 输入n,给出n个字符的字符串,字符串由 英文字母(大小写都包括). 下划线'_' . ...
- Codeforces Gym 100269B Ballot Analyzing Device 模拟题
Ballot Analyzing Device 题目连接: http://codeforces.com/gym/100269/attachments Description Election comm ...
- Codeforces Round #528-A. Right-Left Cipher(字符串模拟)
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- codeforces gym 101164 K Cutting 字符串hash
题意:给你两个字符串a,b,不区分大小写,将b分成三段,重新拼接,问是否能得到A: 思路:暴力枚举两个断点,然后check的时候需要字符串hash,O(1)复杂度N*N: 题目链接:传送门 #prag ...
- codeforces gym 100286 H - Hell on the Markets (贪心算法)
题目链接 题意:n个数分别为a[i],问是否存在一组对应的b[i],b[i]=1 || b[i]=-1,使得ai*bi的n项和为0. 题解: 先证明一个结论吧,对于1≤ai≤i+1,前面ai个数一定可 ...
- Codeforces Gym 100286I iSharp 模拟
原题地址:http://codeforces.com/gym/100286/attachments/download/2013/20082009-acmicpc-northeastern-europe ...
- Codeforces Round #425 (Div. 2) B. Petya and Exam(字符串模拟 水)
题目链接:http://codeforces.com/contest/832/problem/B B. Petya and Exam time limit per test 2 seconds mem ...
- Codeforces Gym 100286J Javanese Cryptoanalysis 傻逼暴力
原题地址:http://codeforces.com/gym/100286/attachments/download/2013/20082009-acmicpc-northeastern-europe ...
随机推荐
- web开发前端学习
bootstrap: http://www.bootcss.com/ bootstrap: http://bootsnipp.com/snippets/featured/single-colum ...
- HDOJ 2444 The Accomodation of Students
染色判读二分图+Hungary匹配 The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others) Memory Limi ...
- I’ve seen the world,lit it up as my stage now
I've seen the world,lit it up as my stage now 阅尽繁华 点亮红尘做舞台 Channeling angels in,the new age now 粉末登场 ...
- Knockout.Js案例二Working With Lists And Collections
案例一:Foreach绑定 通常,您要生成重复的UI元素,特别是当显示列表,用户可以添加和删除元素.KO.JS让你轻松,使用的数组和foreach绑定. 在接下来的几分钟,您将构建一个动态UI保留席位 ...
- JAVA设计模式 之 观察者模式
简介: 观察者模式是JDK中最多的设计模式之一,非常有用,观察者模式介绍了一对多的依赖关系及松耦合,有了观察者,你将会消息灵通. 认识观察者模式,看一个报纸.杂志订阅是怎么回事: (1). 报社的业务 ...
- 使用liunx部署的心得
安装SSH. 输入IP,输入用户名,点击连接,再输入密码. 如果采用的tomcat容器,则: 第一步: 查看正在运行的tomcat ps aux|grep tomcat 如果输出信息很长代表启动了的, ...
- aspcms 留言 搜索
留言: <form method='POST' name='myform' onSubmit='return metmessagesubmit("姓名不能为空"," ...
- web服务器页面错误代码集
HTTP 1xx-信息提示 这些状态代码表示临时的响应.客户端在收到常规响应之前,应准备接收一个或多个1xx响应. 100-继续. 101-切换协议. 2xx-成功 这类状态代码表明服务器成功地接受了 ...
- OSI参考模型与TCP/IP协议模型
OSI和TCP/IP都是为了计算机之间更好的互联的. 计算机网络是一个复杂的系统,比如两台计算机进行通信不仅仅只是有一条通信线就可以了. 还有很多的工作需要完成,例如: 如何知道对方计算机是否做好准备 ...
- xp远程桌面登陆需要身份验证问题解决
今天在客户这边部署了一个专门用于远程访问的计算机,但是系统是xp,windows服务器最新的已经到2012版本了,windows服务器从2008开始就要求远程桌面登陆支持nla,因此在使用xp登陆wi ...