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 ...
随机推荐
- 基于局部敏感哈希的协同过滤算法之simHash算法
搜集了快一个月的资料,虽然不完全懂,但还是先慢慢写着吧,说不定就有思路了呢. 开源的最大好处是会让作者对脏乱臭的代码有羞耻感. 当一个做推荐系统的部门开始重视[数据清理,数据标柱,效果评测,数据统计, ...
- firefly 环境配置所需工具
原地址:http://www.9miao.com/question-15-59032.html http://down.9miao.com/attachment/forum/201405/19/120 ...
- python参考手册--第9章
1.读取命令行选项 (1)sys.args python启动时,命令行选项设置在列表sys.args中. sys.args[0]:xxx.py sys.args[1:]: 其他参数 (2)optpar ...
- HDU1569+最大点权集
/* 最大点权独立集=总权值-最小点权覆盖集 最大点权独立集=最大流 最小点权覆盖集=最小割 题意: 给你一个m*n的格子的棋盘,每个格子里面有一个非负数. 从中取出若干个数,使得任意的两个数所在的格 ...
- 深入剖析Classloader(二)--根类加载器,扩展类加载器与系统类加载器
原文地址:http://yhjhappy234.blog.163.com/blog/static/31632832201152555245584/?suggestedreading&wumii ...
- 基于http.sys来开发的,真的是非常稳定
真正的WEB服务器是不会用Indy写的.因为它是基于每连接每线程的. 其实真正的服务器需要下很多功夫,无法快速开发的.比如说,字符串处理.玩服务器基本上就是玩内存.举个例子: var str:Ansi ...
- POJ2993——Emag eht htiw Em Pleh(字符串处理+排序)
Emag eht htiw Em Pleh DescriptionThis problem is a reverse case of the problem 2996. You are given t ...
- fedora
http://blog.chinaunix.net/uid-14735472-id-3486501.html 使用 http://blog.csdn.net/crystony/article/deta ...
- ssh-keygen的使用方法
一.概述 1.就是为了让两个linux机器之间使用ssh不需要用户名和密码.采用了数字签名RSA或者DSA来完成这个操作 2.模型分析 假设 A (192.168.20.59)为客户机器,B(192. ...
- java ServerSocket服务端编程
public class Test { public static void main(String[] args) throws Exception{ //1. 构造ServerSocket实例,指 ...