打开题目链接

题意:输入一个字符串,用,或;分隔输出字符串和整数(不含前导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. selenium学习总结

    selenium主要用来做web自动化,分1.0和2.0两个版本,1.0包括selenium IDE.selenium Grid.selenium Remote Control,2.0在1.0的基础上 ...

  2. tcl之正则表达式

  3. 阿里云Linux服务器,挂载硬盘并将系统盘数据迁移到数据盘

    因为之前用宝塔上线,宝塔只挂载了系统盘50G,打开阿里云云盘列表发现系统盘无法直接升级,故另买一块数据盘挂载到Linux服务器下,下面根据网上教程再结合我实际情况讲解一下实际操作,其实非常easy l ...

  4. python学习之控制流1

    配置环境:python 3.6 python编辑器:pycharm 代码如下: #!/usr/bin/env python #-*- coding: utf-8 -*- # 控制流: # 1.布尔值: ...

  5. GDOI--DAY2 游记

    今天,熬夜不够多,果然,不出所料,爆零了... 第一题,看到数据之大,懵逼了,于是,敲了个二分SPFA,但是!最大的点GG了,呜呜~~~~(>_<)~~~~ ,于是,就不继续做第一题了(虽 ...

  6. [Bzoj2282]消防(二分答案+树的直径)

    Description 某个国家有n个城市,这n个城市中任意两个都连通且有唯一一条路径,每条连通两个城市的道路的长度为zi(zi<=1000). 这个国家的人对火焰有超越宇宙的热情,所以这个国家 ...

  7. Android 懒加载简单介绍

    1.懒加载介绍 1.1.效果预览 1.2.效果讲解 当页面可见的时候,才加载当前页面. 没有打开的页面,就不会预加载. 说白了,懒加载就是可见的时候才去请求数据. 1.3.懒加载文章传送门 参考文章: ...

  8. Unity Occlusion Culling 遮挡剔除研究

    本文章由cartzhang编写,转载请注明出处. 所有权利保留. 文章链接:http://blog.csdn.net/cartzhang/article/details/52684127 作者:car ...

  9. git 设置别名 git alias

    git config --global alias.st status git config --global alias.ck checkout git config --global alias. ...

  10. 网易OpenStack部署运维实战

    OpenStack自2010年项目成立以来,已经有超过200个公司加入了 OpenStack 项目,目前参与 OpenStack 项目的开发人员有 17,000+,而且这些数字还在增加,作为一个开源的 ...