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\)条边,使得 ...
随机推荐
- java在线聊天项目0.4版本 制作服务端接收连接,客户端连接功能 新增客户端窗口打开时光标指向下边文本域功能,使用WindowListener监听WindowAdapter
建一个服务端类ChatServer,用于设置端口接收连接 package com.swift; import java.io.IOException; import java.net.ServerSo ...
- Mysql 5.7在Linux上部署及远程访问
序言:最近要和伙伴一起组队,做.NET Core项目.所以自己就租了一个阿里云服务器,并且装了Linux和MySQL.这里面我的Linux是CentOs 7. 第一步 添加Mysql Yum库 这里面 ...
- Ubuntu中安装配置 JDK与apache
一,前期准备: 1.下载apach网址:https://tomcat.apache.org/download-90.cgi 3.下载:jdk网址:http://www.oracle.com/techn ...
- vue2.0的基本特性
本文目前总结的特性如下1.侦听属性和计算属性2.class的绑定3.条件渲染时的注意事项4.v-if和v-for同时使用的注意事项5.插槽6.ref,父组件调用子组件的另一种方式7.<keep- ...
- 【css】清楚浏览器端缓存
/css/common.css?version=1.0.7 在css链接后面加个参数版本号控制,刷新浏览器缓存
- spring junit4 单元测试运行正常,但是数据库并无变化
解决方案 http://blog.csdn.net/molingduzun123/article/details/49383235 原因:Spring Juint为了不污染数据,对数据的删除和更新操作 ...
- Spring 结构
Spring框架主要由7大模块组成,它们提供了企业级开发需要的所有功能,而且每个模块都可以单独使用,也可以和其它模块组合使用,灵活且方便的部署可以使开发的程序更加简单灵活. 核心模块 Spring C ...
- Oracle跟踪分析数据库启动的各个阶段
目录 启动到nomount状态 设置trace 启动数据库到mount状态并打开 查阅trace 查阅trace的另外方法 v$diag_info 视图 演示如下: 启动到nomount状态 SYS@ ...
- NYOJ 747 蚂蚁的难题(三)
蚂蚁的难题(三) 时间限制:2000 ms | 内存限制:65535 KB 难度:4 描述 蚂蚁终于把尽可能多的食材都搬回家了,现在开始了大厨计划. 已知一共有 n 件食材,每件食材有一个美味 ...
- Leetcode 336.回文对
回文对 给定一组唯一的单词, 找出所有不同 的索引对(i, j),使得列表中的两个单词, words[i] + words[j] ,可拼接成回文串. 示例 1: 输入: ["abcd&quo ...