学习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. MVC 自定义AuthorizeAttribute 实现权限验证

    MVC内置的AuthorizeFilter先于Action/Result过滤器执行,为网站权限验证提供了很好的一套验证机制. 通过自定义的AuthorizeAttribute可以实现对用户权限的验证. ...

  2. Hadoop之RPC

           Hadoop的RPC主要是通过Java的动态代理(Dynamic Proxy)与反射(Reflect)实现,代理类是由java.lang.reflect.Proxy类在运行期时根据接口, ...

  3. iOS开发笔记--宏定义的黑魔法 - 宏菜鸟起飞手册

    宏定义在C系开发中可以说占有举足轻重的作用.底层框架自不必说,为了编译优化和方便,以及跨平台能力,宏被大量使用,可以说底层开发离开define将寸步难行.而在更高层级进行开发时,我们会将更多的重心放在 ...

  4. maven更新总结与tomcat发布方法总结

    这些天来一直为不能直接把项目实时的发布到tomcat而费心思,项目使用了maven来组织,编译和运行,而maven插件的安装曾经有些问题,为此怀疑不能发布项目到tomcat是因为maven有问题,为些 ...

  5. javaweb学习总结(四十四)——监听器(Listener)学习

    一.监听器介绍 1.1.监听器的概念

  6. SPRING IN ACTION 第4版笔记-第九章Securing web applications-009-拦截请求()

    一. 对特定的请求拦截 For example, consider the requests served by the Spittr application. Certainly, thehome ...

  7. Java API ——Scanner类

    1.Scanner类概述 JDK5以后用于获取用户的键盘输入,一个可以使用正则表达式来解析基本类型和字符串的简单文本扫描器.Scanner 使用分隔符模式将其输入分解为标记,默认情况下该分隔符模式与空 ...

  8. C#获取本地打印机列表,并将指定打印机设置为默认打印机

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...

  9. 【POJ】3468 A Simple Problem with Integers

    这题用线段树轻松解了,重新用树状数组解,关键点是区间更新.公式推导如下:sum[x] = org_sum[x] + delta[1]*x + delta[2]*(x-1) + delta[x]*1   ...

  10. nginx+lua+redis实现logserver

    http://www.baidu.com/s?wd=nginx lua&pn=10&oq=nginx lua&tn=baiduhome_pg&ie=utf-8& ...