codeforce 600A - Extract Numbers
学习string
#include <bits/stdc++.h>
#define eps 1e-8
#define M_PI 3.141592653589793
const int N = ;
using namespace std; string st;
vector<string>v1,v2; bool judge(string str)
{
if(str.size()==)
return false;
for(int i=; i<str.size(); i++)
{
if(str[i]>''||str[i]<'')
return false;
}
if(str.size()>&&str[]=='')
return false;
return true;
} void add(string str)
{
if(judge(str))
v1.push_back(str);
else
v2.push_back(str);
} int main()
{
cin>>st;
string temp="";
for(int i=; i<st.size(); i++)
{
if(st[i]==','||st[i]==';')
{
add(temp);
temp="";
}
else
temp+=st[i];
}
add(temp); if(v1.size()==)
cout<<"-"<<endl;
else
{
cout<<"\"";
for(int i=; i<v1.size(); i++)
{
if(i)
cout<<",";
cout<<v1[i];
}
cout<<"\"";
cout<<endl;
}
if(v2.size()==)
cout<<"-"<<endl;
else
{
cout<<"\"";
for(int i=; i<v2.size(); i++)
{
if(i)
cout<<",";
cout<<v2[i];
}
cout<<"\"";
cout<<endl;
}
return ;
}
codeforce 600A - Extract Numbers的更多相关文章
- Codeforces 600A. Extract Numbers 模拟
A. Extract Numbers time limit per test: 2 seconds memory limit per test: 256 megabytes input: standa ...
- codeforces 600A Extract Numbers
模拟题,意思是一个字符串,单词直接用','或';'来分割,可以为空,把不含前导0的整数和其他单词分别放入A和B.按照一定格式输出. 没有用stl的习惯.维护两个下标i,j,表示开区间(i,j),两段补 ...
- Educational Codeforces Round 2 A. Extract Numbers 模拟题
A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/pr ...
- [模拟]Educational Codeforces Round 2A Extract Numbers
Extract Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- codeforce - 13A A.Numbers
A. Numbers time limit per test 1 second memory limit per test 64 megabytes input standard input outp ...
- Educational Codeforces Round 2 A. Extract Numbers
打开题目链接 题意:输入一个字符串,用,或:分隔输出字符串和整数(不含前导0和浮点数) ACcode: #include <iostream> #include <cstdio> ...
- Educational Codeforces Round 2
600A - Extract Numbers 20171106 字符串处理题,稍微注意点细节就能水过 #include<stdlib.h> #include<stdio.h&g ...
- codeforce round#466(div.2)C. Phone Numbers
C. Phone Numbers time limit per test2 seconds memory limit per test256 megabytes inputstandard input ...
- Codeforce 9C - Hexadecimal's Numbers
One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got ...
随机推荐
- [转载]mvc使用JsonResult返回Json数据
controller 中定义以下方法: public JsonResult UpdateSingle(int id, string actionName, string actionValue) { ...
- JVM并发机制的探讨——内存模型、内存可见性和指令重排序
并发本来就是个有意思的问题,尤其是现在又流行这么一句话:“高帅富加机器,穷矮搓搞优化”. 从这句话可以看到,无论是高帅富还是穷矮搓都需要深入理解并发编程,高帅富加多了机器,需要协调多台机器或者多个CP ...
- iOS开发之loadView、viewDidLoad及viewDidUnload的关系
iOS开发之loadView.viewDidLoad及viewDidUnload的关系 iOS开发之loadView.viewDidLoad及viewDidUnload的关系 标题中所说的3个方 ...
- APK签名校验绕过
APK签名校验绕过 Android JNI 获取应用签名 android apk 防止反编译技术第一篇-加壳技术 android apk 防止反编译技术第五篇-完整性校验 利用IDA Pro反汇编程序 ...
- (原创)CityEngine 2014和ArcGIS 10.3冲突问题的解决
先卸载ArcGIS License Manager 10.3 安装ArcGIS License Manager 10.2.2 用keygen算出ArcGIS 10.3的许可,似乎本许可在ArcGI ...
- Flash Builder 4.6 基本设置
Flash Builder 4.6 字体修改 打开Flash Builder4.6 -> 窗口 -> 首选项 -> 左边目录选择常规 -> 外观 -> 颜色和字体 -&g ...
- JNDI和在tomcat中配置DBCP连接池 元数据的使用 DBUtils框架的使用 多表操作
1 JNDI和在tomcat中配置DBCP连接池 JNDI(Java Naming and Directory Interface),Java命名和目录接口,它对应于J2SE中的javax.namin ...
- poj3114Countries in War(缩点+DIJK)
http://poj.org/problem?id=3114 缩点+DIJK 注意缩点之后有重边啊 floyd会TLE #include <iostream> #include<cs ...
- poj 1125 Stockbroker Grapevine(最短路 简单 floyd)
题目:http://poj.org/problem?id=1125 题意:给出一个社交网络,每个人有几个别人可以传播谣言,传播谣言需要时间.问要使得谣言传播的最快,应该从那个人开始传播谣言以及使得所有 ...
- mysql 读取硬盘数据
innodb 的最小管理单位是页 innodb的最小申请单位是区,一个区 1M,内含64个页,每个页16K ,即 64*16K=1M, 考虑到硬盘局部性,每次读取4个区,即读4M的数据加载至内存 线性 ...