学习string

  1. #include <bits/stdc++.h>
  2. #define eps 1e-8
  3. #define M_PI 3.141592653589793
  4. const int N = ;
  5. using namespace std;
  6.  
  7. string st;
  8. vector<string>v1,v2;
  9.  
  10. bool judge(string str)
  11. {
  12. if(str.size()==)
  13. return false;
  14. for(int i=; i<str.size(); i++)
  15. {
  16. if(str[i]>''||str[i]<'')
  17. return false;
  18. }
  19. if(str.size()>&&str[]=='')
  20. return false;
  21. return true;
  22. }
  23.  
  24. void add(string str)
  25. {
  26. if(judge(str))
  27. v1.push_back(str);
  28. else
  29. v2.push_back(str);
  30. }
  31.  
  32. int main()
  33. {
  34. cin>>st;
  35. string temp="";
  36. for(int i=; i<st.size(); i++)
  37. {
  38. if(st[i]==','||st[i]==';')
  39. {
  40. add(temp);
  41. temp="";
  42. }
  43. else
  44. temp+=st[i];
  45. }
  46. add(temp);
  47.  
  48. if(v1.size()==)
  49. cout<<"-"<<endl;
  50. else
  51. {
  52. cout<<"\"";
  53. for(int i=; i<v1.size(); i++)
  54. {
  55. if(i)
  56. cout<<",";
  57. cout<<v1[i];
  58. }
  59. cout<<"\"";
  60. cout<<endl;
  61. }
  62. if(v2.size()==)
  63. cout<<"-"<<endl;
  64. else
  65. {
  66. cout<<"\"";
  67. for(int i=; i<v2.size(); i++)
  68. {
  69. if(i)
  70. cout<<",";
  71. cout<<v2[i];
  72. }
  73. cout<<"\"";
  74. cout<<endl;
  75. }
  76. return ;
  77. }

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. ./configure详解

    'configure'脚本有大量的命令行选项.对不同的软件包来说,这些选项可能会有变化,但是许多基本的选项是不会改变的.带上'--help'选项执行'configure'脚本可以看到可用的所有选项.尽 ...

  2. [转载]MongoDB查询优化原则

    .在查询条件.排序条件.统计条件的字段上选择创建索引,可以显著提高查询效率. .用$or时把匹配最 多 结果的条件放在最前面,用$and时把匹配最 少 结果的条件放在最前面. .使用limit()限定 ...

  3. Navicat for mysql 远程连接 mySql数据库10061、1045错误问题 (转)

    远程使用Navicat for mysql 客户端软件连接 mySql数据时,连接出现 2003-Can’t connect to MySQL on ’192.168.1.2’(10061)错误时,是 ...

  4. Spring MVC Checkbox And Checkboxes Example

    In Spring MVC, <form:checkbox /> is used to render a HTML checkbox field, the checkbox values ...

  5. Servlet课程0424(二) 通过继承GenericServlet来开发Servlet

    //这是第二种开发servlet的方法(继承GernericServlet) package com.tsinghua; import javax.servlet.GenericServlet; im ...

  6. Altium designer中级篇-名称决定多边形连接样式

    在工作中积累了诸多小技巧,可以让工作变的更简单,就比如这个多边形铺铜,与大部分规则的不同之处在于,通过更改多边形的名称,就能达到控制多边形规则的效果.这样多边形铺铜变的及其灵活,下面将对这个经验做一个 ...

  7. Centos后台运行jar

    jar后台运行 nohup java -jar xx.jar >/dev/null & 此处的">/dev/null"作用是将终端输出信息输出到空洞中,即不保存 ...

  8. linux命令之-pstree使用说明

    pstree  shows running processes as a tree. The tree is rooted at either pid or init if pid is omitte ...

  9. 怎么知道RTL Schematic中的instance与哪段代码对应呢

    2013-06-23 20:15:47 ISE综合后可以看到RTL Schematic,但我们知道在RTL编码时,要经常问自己一个问题“我写的这段代码会综合成什么样的电路呢”.对于一个简单的设计,比如 ...

  10. 微软嵌入式WEC2013产品研讨会(深圳站---2013.10.16)

    主要内容如下: 1.      Windows Embedded Compact 2013面向的市场 主要面向工业自动化.医疗设备和零售行业这些市场,和物联网关系非常紧密. 2.      Windo ...