打开题目链接

题意:输入一个字符串,用,或;分隔输出字符串和整数(不含前导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. struts2之标签库

    使用Struts2标签的准备工作: 导入Struts2标签库,该标签定义文件位于 struts2-core-2.3.16.3.jar 的 METE-INF下的struts-tag.tld文件. < ...

  2. c# 解决读取Excel混合文本类型,数据读取失败的解决方法

    错误重现: ----------------------------------------------------------------------- 在导入Excel读取数据时,其中的一个字段保 ...

  3. (转)基于REST架构的Web Service设计

    原文出处:http://www.williamlong.info/archives/1728.html ------------------------------------------------ ...

  4. Gson转Map时,Int会变成double解决方法

    package com.cdy.demo; import java.lang.reflect.Type; import java.util.HashMap; import java.util.Map; ...

  5. Pythond函数的参数使用操作注意事项

    定义函数的时候,我们把参数的名字和位置确定下来,函数的接口定义就完成了.对于函数的调用者来说,只需要知道如何传递正确的参数,以及函数将返回什么样的值就够了,函数内部的复杂逻辑被封装起来,调用者无需了解 ...

  6. Android Studio的Log日志调试

    本人菜鸟一枚,极大发挥了搜索的功能.现记录一番,以备后患. 用断点真的很烦,因为之前写linux的时候,就是用最蠢但是也是挺有帮助的printf()来进行调试. 其实用Log输出日志的原理也是差不多的 ...

  7. CodeForces 771C Bear and Tree Jumps 树形DP

    题意: 给出一棵树,一个人可以在树上跳,每次最多跳\(k(1 \leq k \leq 5)\)个点 定义\(f(s,t)\)为从顶点\(s\)跳到顶点\(t\)最少需要跳多少次 求\(\sum\lim ...

  8. web.py上传文件并解压

    有个需求是从php端上传zip文件到python端并且解压到指定目录,以下是解决方法 1.python端,使用的web.py def POST(self): post_data = web.input ...

  9. Win Server 8中的利器:微软在线备份服务

    微软在Windows Server 8中添加在线备份服务了?你一定以为我在开玩笑,是吧?但是微软确实这么做了.     微软在Windows Server 8中添加在线备份服务了?你一定以为我在开玩笑 ...

  10. 《Cracking the Coding Interview》——第5章:位操作——题目6

    2014-03-19 06:24 题目:将一个整数的奇偶二进制位交换,(0, 1) (2, 3) ... 解法:使用掩码来进行快速交换,定义掩码为'0101...'和‘1010...’. 代码: // ...