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 ...
随机推荐
- ./configure详解
'configure'脚本有大量的命令行选项.对不同的软件包来说,这些选项可能会有变化,但是许多基本的选项是不会改变的.带上'--help'选项执行'configure'脚本可以看到可用的所有选项.尽 ...
- [转载]MongoDB查询优化原则
.在查询条件.排序条件.统计条件的字段上选择创建索引,可以显著提高查询效率. .用$or时把匹配最 多 结果的条件放在最前面,用$and时把匹配最 少 结果的条件放在最前面. .使用limit()限定 ...
- Navicat for mysql 远程连接 mySql数据库10061、1045错误问题 (转)
远程使用Navicat for mysql 客户端软件连接 mySql数据时,连接出现 2003-Can’t connect to MySQL on ’192.168.1.2’(10061)错误时,是 ...
- Spring MVC Checkbox And Checkboxes Example
In Spring MVC, <form:checkbox /> is used to render a HTML checkbox field, the checkbox values ...
- Servlet课程0424(二) 通过继承GenericServlet来开发Servlet
//这是第二种开发servlet的方法(继承GernericServlet) package com.tsinghua; import javax.servlet.GenericServlet; im ...
- Altium designer中级篇-名称决定多边形连接样式
在工作中积累了诸多小技巧,可以让工作变的更简单,就比如这个多边形铺铜,与大部分规则的不同之处在于,通过更改多边形的名称,就能达到控制多边形规则的效果.这样多边形铺铜变的及其灵活,下面将对这个经验做一个 ...
- Centos后台运行jar
jar后台运行 nohup java -jar xx.jar >/dev/null & 此处的">/dev/null"作用是将终端输出信息输出到空洞中,即不保存 ...
- linux命令之-pstree使用说明
pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitte ...
- 怎么知道RTL Schematic中的instance与哪段代码对应呢
2013-06-23 20:15:47 ISE综合后可以看到RTL Schematic,但我们知道在RTL编码时,要经常问自己一个问题“我写的这段代码会综合成什么样的电路呢”.对于一个简单的设计,比如 ...
- 微软嵌入式WEC2013产品研讨会(深圳站---2013.10.16)
主要内容如下: 1. Windows Embedded Compact 2013面向的市场 主要面向工业自动化.医疗设备和零售行业这些市场,和物联网关系非常紧密. 2. Windo ...