打开题目链接

题意:输入一个字符串,用,或;分隔输出字符串和整数(不含前导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. 基于Ceph分布式集群实现docker跨主机共享数据卷

    上篇文章介绍了如何使用docker部署Ceph分布式存储集群,本篇在此基础之上,介绍如何基于Ceph分布式存储集群实现docker跨主机共享数据卷. 1.环境准备 在原来的环境基础之上,新增一台cen ...

  2. egg的使用方法

    1.controller const {ctx,service} = this: let id = ctx.query.id // 获取GET的参数 let body = ctx.request.bo ...

  3. ubuntu built-in display 产生的一个原因

    在没有禁用开源的显卡驱动 nouveau 下,从 apt 安装了nvidia的驱动,导致了后面开机后,系统不能正确的识别到显示器,整个界面分辨率变的非常小,在设置菜单中的显示设置中也不能调节分辨率,并 ...

  4. Ubuntu 下安装GIMP

    1.Add GIMP PPA Open terminal from Unity Dash, App launcher, or via Ctrl+Alt+T shortcut key. When it ...

  5. laravel 安装excel扩展

    1,使用Composer安装依赖 在Laravel项目根目录下使用Composer安装依赖: composer require maatwebsite/excel ~2.1 ps:一定要加上~2.1! ...

  6. 17-比赛1 D - IPC Trainers (贪心 + 优先队列)

    题目描述 本次印度编程训练营(Indian Programming Camp,IPC)共请到了 N 名教练.训练营的日程安排有 M 天,每天最多上一节课.第 i 名教练在第 Di 天到达,直到训练营结 ...

  7. python基础之流程控制、数字和字符串处理

    流程控制 条件判断 if单分支:当一个“条件”成立时执行相应的操作. 语法结构: if 条件: command 流程图: 示例:如果3大于2,那么输出字符串"very good" ...

  8. scrapy如何实现分布式爬虫

    使用scrapy爬虫的时候,记录一下如何分布式爬虫问题: 关键在于多台主机协作的关键:共享爬虫队列 主机:维护爬取队列从机:负责数据抓取,数据处理,数据存储 队列如何维护:Redis队列Redis 非 ...

  9. TouTiao开源项目 分析笔记19 问答内容

    1.真实页面预览 1.1.成果预览 首先是问答列表 然后每个item设置点击事件,进入问答内容列表 然后每一个问答内容也设置点击事件,进入问答详情 1.2.触发事件. 在WendaArticleOne ...

  10. 20145202马超 《Java程序设计》第三周学习总结

    ************************http://git.oschina.net/tuolemi/java这是git的那个网址********************* 函数的重载:在同一 ...