学习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. 基于局部敏感哈希的协同过滤算法之simHash算法

    搜集了快一个月的资料,虽然不完全懂,但还是先慢慢写着吧,说不定就有思路了呢. 开源的最大好处是会让作者对脏乱臭的代码有羞耻感. 当一个做推荐系统的部门开始重视[数据清理,数据标柱,效果评测,数据统计, ...

  2. firefly 环境配置所需工具

    原地址:http://www.9miao.com/question-15-59032.html http://down.9miao.com/attachment/forum/201405/19/120 ...

  3. python参考手册--第9章

    1.读取命令行选项 (1)sys.args python启动时,命令行选项设置在列表sys.args中. sys.args[0]:xxx.py sys.args[1:]: 其他参数 (2)optpar ...

  4. HDU1569+最大点权集

    /* 最大点权独立集=总权值-最小点权覆盖集 最大点权独立集=最大流 最小点权覆盖集=最小割 题意: 给你一个m*n的格子的棋盘,每个格子里面有一个非负数. 从中取出若干个数,使得任意的两个数所在的格 ...

  5. 深入剖析Classloader(二)--根类加载器,扩展类加载器与系统类加载器

    原文地址:http://yhjhappy234.blog.163.com/blog/static/31632832201152555245584/?suggestedreading&wumii ...

  6. 基于http.sys来开发的,真的是非常稳定

    真正的WEB服务器是不会用Indy写的.因为它是基于每连接每线程的. 其实真正的服务器需要下很多功夫,无法快速开发的.比如说,字符串处理.玩服务器基本上就是玩内存.举个例子: var str:Ansi ...

  7. POJ2993——Emag eht htiw Em Pleh(字符串处理+排序)

    Emag eht htiw Em Pleh DescriptionThis problem is a reverse case of the problem 2996. You are given t ...

  8. fedora

    http://blog.chinaunix.net/uid-14735472-id-3486501.html 使用 http://blog.csdn.net/crystony/article/deta ...

  9. ssh-keygen的使用方法

    一.概述 1.就是为了让两个linux机器之间使用ssh不需要用户名和密码.采用了数字签名RSA或者DSA来完成这个操作 2.模型分析 假设 A (192.168.20.59)为客户机器,B(192. ...

  10. java ServerSocket服务端编程

    public class Test { public static void main(String[] args) throws Exception{ //1. 构造ServerSocket实例,指 ...