打开题目链接

题意:输入一个字符串,用,或;分隔输出字符串和整数(不含前导0和浮点数)

ACcode:

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
string s,digit,seq,temp;
int main()
{
cin>>s;
for(int i=0; i<s.length(); i++)
if(s[i] == ',' || s[i] == ';')
s[i] = ' ';
bool flag = false;
s+=" ";
//init
temp = digit = seq = "";
for(int i=0; i<s.length(); i++)
{
if(s[i] == ' ')
{
if(flag || (temp[0] == '0' && temp.length()>1) || temp.length() == 0)
{
seq+=","+temp;
}else
{
digit +=","+temp;
}
temp ="";
flag = false;
continue;
}
if(s[i]<'0' || s[i]>'9')
flag = true;
temp+=s[i];
}
if(digit != "")
{
digit.erase(0,1);
cout<<'"'<<digit<<'"'<<endl;
}else
cout<<"-"<<endl;
if(seq !="")
{
seq.erase(0,1);
cout<<'"'<<seq<<'"'<<endl;
}else
cout<<"-"<<endl; return 0;
}

  

Educational Codeforces Round 2 A. Extract Numbers的更多相关文章

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

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

  2. Educational Codeforces Round 8 D. Magic Numbers 数位DP

    D. Magic Numbers 题目连接: http://www.codeforces.com/contest/628/problem/D Description Consider the deci ...

  3. Educational Codeforces Round 8 D. Magic Numbers

    Magic Numbers 题意:给定长度不超过2000的a,b;问有多少个x(a<=x<=b)使得x的偶数位为d,奇数位不为d;且要是m的倍数,结果mod 1e9+7; 直接数位DP;前 ...

  4. [Educational Codeforces Round 16]C. Magic Odd Square

    [Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...

  5. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...

  6. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

  7. Educational Codeforces Round 32

    http://codeforces.com/contest/888 A Local Extrema[水] [题意]:计算极值点个数 [分析]:除了第一个最后一个外,遇到极值点ans++,包括极大和极小 ...

  8. Educational Codeforces Round 35 A. Nearest Minimums【预处理】

    [题目链接]: Educational Codeforces Round 35 (Rated for Div. 2) A. Nearest Minimums time limit per test 2 ...

  9. Educational Codeforces Round 26

    Educational Codeforces Round 26 困到不行的场,等着中午显示器到了就可以美滋滋了 A. Text Volume time limit per test 1 second ...

随机推荐

  1. Mysql5.7创建存储过程中调用自定义函数报错Not allowed to return a result set from a function

    因为很多存储过程都会共用一段sql语句,所以我把共用的sql封装成一个自定义函数 AddCapital(); 然后通过存储过程调用,创建存储过程会报错1415,Not allowed to retur ...

  2. IntelliJ IDEA 方法注释教程

    首先Ctrl +Alt +S ,打开Settings ,找到Live Template,然后点击右侧的绿色的“+”,选择Template Group 然后给新建的Group随便命个名 选中自己刚才创建 ...

  3. CentOS 7.4使用yum源安装MySQL5.7

    从CentOS 7.0发布以来,yum源中开始使用Mariadb来代替MySQL的安装.即使你输入的是yum install -y mysql , 显示的也是Mariadb的安装内容.使用源代码进行编 ...

  4. 基本数据类型补充,set集合,深浅拷贝等

    1.join:将字符串,列表,用指定的字符连接,也可以用空去连接,这样就可以把列表变成str ll = ["wang","jian","wei&quo ...

  5. 2019-04-11 python入门学习——配置机器及搭建开发环境

    # 在windows操作系统中搭建python 3.x版本的开发环境,开发工具为 Anaconda 3. # 1.1 下载及安装Anaconda 3 Anaconda的特点:集成性高,包含很多常用的开 ...

  6. 关于requestMapping 进行url映射实现小小知识点 以及如何获取请求的url中的参数

    requstMapping 用来处理url映射  可以作用在controller类上  也可以作用在方法上 经常使用的方式  通过接收一种映射关系 @RequestMapping("/del ...

  7. hadoop中namenode发生故障的处理方法

    Namenode 故障后,可以采用如下两种方法恢复数据: 方法一:将 SecondaryNameNode 中数据拷贝到 namenode 存储数据的目录: 方法 二: 使用 -importCheckp ...

  8. wireshark 安装

    #yum install wireshark 安装完毕后 whereis wireshark 找不到可执行程序 /bin /sbin /usr/bin /usr/sbin下均没有. 实际上wiresh ...

  9. Eclipse 修改字符集---Eclipse教程第02课

    默认情况下 Eclipse 字符集为 GBK,但现在很多项目采用的是 UTF-8,这是我们就需要设置我们的 Eclipse 开发环境字符集为 UTF-8, 设置步骤如下: 在菜单栏选择 Window ...

  10. IOS客户端的个人中心可以查看自己的博客了。

    IOS客户端的个人中心可以查看自己的博客了. 写这篇是为了在客户端显示之用. 下一步实现在客户端发博客.