学习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的更多相关文章

  1. Codeforces 600A. Extract Numbers 模拟

    A. Extract Numbers time limit per test: 2 seconds memory limit per test: 256 megabytes input: standa ...

  2. codeforces 600A Extract Numbers

    模拟题,意思是一个字符串,单词直接用','或';'来分割,可以为空,把不含前导0的整数和其他单词分别放入A和B.按照一定格式输出. 没有用stl的习惯.维护两个下标i,j,表示开区间(i,j),两段补 ...

  3. Educational Codeforces Round 2 A. Extract Numbers 模拟题

    A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/pr ...

  4. [模拟]Educational Codeforces Round 2A Extract Numbers

    Extract Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  5. codeforce - 13A A.Numbers

    A. Numbers time limit per test 1 second memory limit per test 64 megabytes input standard input outp ...

  6. Educational Codeforces Round 2 A. Extract Numbers

    打开题目链接 题意:输入一个字符串,用,或:分隔输出字符串和整数(不含前导0和浮点数) ACcode: #include <iostream> #include <cstdio> ...

  7. Educational Codeforces Round 2

    600A - Extract Numbers    20171106 字符串处理题,稍微注意点细节就能水过 #include<stdlib.h> #include<stdio.h&g ...

  8. codeforce round#466(div.2)C. Phone Numbers

    C. Phone Numbers time limit per test2 seconds memory limit per test256 megabytes inputstandard input ...

  9. Codeforce 9C - Hexadecimal's Numbers

    One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got ...

随机推荐

  1. cannot find w3wp.exe in VS

    Same thing was happening to me, when i remembered that IIS has an idle timeout! As above the proc w3 ...

  2. 关于DataTables一些小结

    最近项目中使用了DataTables,故小结了一下. 导入CSS文件<link rel="stylesheet" href="<%=base %>/js ...

  3. Linux下Keepalived 安装与配置

    Keepalived 安装与配置 一.环境说明 1.操作系统内核版本:2.6.9-78.ELsmp 2.Keepalived软件版本:keepalived-1.1.20.tar.gz 二.环境配置 1 ...

  4. Android:Style和Theme

    在Web开发中,Html负责内容,CSS负责表现.同样,在Android开发中,可以使用Theme.Style+UI组件的方式实现内容和形式的分离. Style是针对窗体元素级别的,改变指定控件或者L ...

  5. Android安全问题 程序锁

    导读:本文介绍如何实现对应用加锁的功能,无须root权限 某些人有时候会有这样一种需求,小A下载了个软件,只是软件中的美女过于诱惑与暴露,所以他不想让别人知道这是个什么软件,起码不想让别人打开浏 览. ...

  6. How to learn C++ and find all STL Algorithm reference

    You can find all cpp references on websites: http://zh.cppreference.com/ http://www.cplusplus.com/re ...

  7. 微软嵌入式WEC2013产品研讨会(深圳站---2013.10.16)

    主要内容如下: 1.      Windows Embedded Compact 2013面向的市场 主要面向工业自动化.医疗设备和零售行业这些市场,和物联网关系非常紧密. 2.      Windo ...

  8. poj 3041 Asteroids (二分图的最大匹配 第一题)

    题目:http://poj.org/problem?id=3041 题意:在某个n*n的空间内,分布有一些小行星,某人在里面打炮,放一枪后某一行或某一列的行星就都没了,让求最少的打炮数. 然后把每行x ...

  9. ORACLE【0】:基本操作

    最新工作中用到oracle越来越多,自己虽然也能写点SQL.存储过程.触发器什么的,但是对数据库管理还是陌生的很,现在就将自己最近所学的一步一步整理下来. 1.windows上如何启动oracle 安 ...

  10. Vim cscope

    /********************************************************************** * Vim cscope * 说明: * 之前使用Vim ...