zoukankan      html  css  js  c++  java
  • codeforce 600A

    学习string

     1 #include <bits/stdc++.h>
     2 #define eps 1e-8
     3 #define M_PI 3.141592653589793
     4 const int N = 100005;
     5 using namespace std;
     6 
     7 string st;
     8 vector<string>v1,v2;
     9 
    10 bool judge(string str)
    11 {
    12     if(str.size()==0)
    13         return false;
    14     for(int i=0; i<str.size(); i++)
    15     {
    16         if(str[i]>'9'||str[i]<'0')
    17             return false;
    18     }
    19     if(str.size()>1&&str[0]=='0')
    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=0; 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()==0)
    49         cout<<"-"<<endl;
    50     else
    51     {
    52         cout<<""";
    53         for(int i=0; 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()==0)
    63         cout<<"-"<<endl;
    64     else
    65     {
    66         cout<<""";
    67         for(int i=0; i<v2.size(); i++)
    68         {
    69             if(i)
    70                 cout<<",";
    71                 cout<<v2[i];
    72         }
    73         cout<<""";
    74         cout<<endl;
    75     }
    76     return 0;
    77 }
    View Code
  • 相关阅读:
    HDFS DataNode 多目录
    HDFS DataNode 退役 旧节点
    HDFS DateNoda 服役 新节点
    HDFS DataNode 时限参数设置
    HDFS NameNode 多目录
    HDFS 安全模式
    HDFS NameNode故障排除
    HDFS CheckPoint时间设置
    HDFS NameNode和SecondaryNameNode
    微信小程序:上拉加载更多
  • 原文地址:https://www.cnblogs.com/ITUPC/p/5002361.html
Copyright © 2011-2022 走看看