codeforce 600A - Extract Numbers
学习string
#include <bits/stdc++.h>
#define eps 1e-8
#define M_PI 3.141592653589793
const int N = ;
using namespace std; string st;
vector<string>v1,v2; bool judge(string str)
{
if(str.size()==)
return false;
for(int i=; i<str.size(); i++)
{
if(str[i]>''||str[i]<'')
return false;
}
if(str.size()>&&str[]=='')
return false;
return true;
} void add(string str)
{
if(judge(str))
v1.push_back(str);
else
v2.push_back(str);
} int main()
{
cin>>st;
string temp="";
for(int i=; i<st.size(); i++)
{
if(st[i]==','||st[i]==';')
{
add(temp);
temp="";
}
else
temp+=st[i];
}
add(temp); if(v1.size()==)
cout<<"-"<<endl;
else
{
cout<<"\"";
for(int i=; i<v1.size(); i++)
{
if(i)
cout<<",";
cout<<v1[i];
}
cout<<"\"";
cout<<endl;
}
if(v2.size()==)
cout<<"-"<<endl;
else
{
cout<<"\"";
for(int i=; i<v2.size(); i++)
{
if(i)
cout<<",";
cout<<v2[i];
}
cout<<"\"";
cout<<endl;
}
return ;
}
codeforce 600A - Extract Numbers的更多相关文章
- Codeforces 600A. Extract Numbers 模拟
A. Extract Numbers time limit per test: 2 seconds memory limit per test: 256 megabytes input: standa ...
- codeforces 600A Extract Numbers
模拟题,意思是一个字符串,单词直接用','或';'来分割,可以为空,把不含前导0的整数和其他单词分别放入A和B.按照一定格式输出. 没有用stl的习惯.维护两个下标i,j,表示开区间(i,j),两段补 ...
- Educational Codeforces Round 2 A. Extract Numbers 模拟题
A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/pr ...
- [模拟]Educational Codeforces Round 2A Extract Numbers
Extract Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- codeforce - 13A A.Numbers
A. Numbers time limit per test 1 second memory limit per test 64 megabytes input standard input outp ...
- Educational Codeforces Round 2 A. Extract Numbers
打开题目链接 题意:输入一个字符串,用,或:分隔输出字符串和整数(不含前导0和浮点数) ACcode: #include <iostream> #include <cstdio> ...
- Educational Codeforces Round 2
600A - Extract Numbers 20171106 字符串处理题,稍微注意点细节就能水过 #include<stdlib.h> #include<stdio.h&g ...
- codeforce round#466(div.2)C. Phone Numbers
C. Phone Numbers time limit per test2 seconds memory limit per test256 megabytes inputstandard input ...
- Codeforce 9C - Hexadecimal's Numbers
One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got ...
随机推荐
- [转载]jQuery.lazyload详解 - 图片延时加载
jQuery实现图片延迟加载,不知道是否可以节省带宽呢?有人知道吗? 这究竟只是一个视觉特效还是真的能延迟加载减少服务器的请求呢? <script type="text/javascr ...
- 时序列数据库武斗大会之什么是 TSDB ?
本文选自 OneAPM Cloud Insight 高级工程师刘斌博客 . 刘斌,一个才思敏捷的程序员,<第一本 Docker 书>.<GitHub 入门与实践>等书籍译者,D ...
- zoj 3640 Help Me Escape 概率DP
记忆化搜索+概率DP 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include ...
- linux MySQL安装配置
执行下面的命令初始化授权表: ./scripts/mysql_install_db --user=mysql
- C++中的指针与const
刚开始接触C++时,指针和const之间的关系有点混乱,现在总结如下: 一.指向const变量的指针 #include<iostream.h> void main() { const in ...
- Android 签名(2)签名知识要点
要点 1) 所有的应用程序都必须有数字证书,Android系统不会安装一个没有数字证书的应用程序 2) Android程序包使用的数字证书可以是自签名的,不需要一个权威的数字证书机构签名认证 3) 如 ...
- 使用Unity3d的Physics.Raycast()的用法做子弹射击
Class Functions 1)static function Raycast (origin : Vector3, direction : Vector3, distance : float = ...
- C#调用Geocoding API进行地理编码与逆编码
使用C#调用Geocoding API来将地址转为经纬度,或者将经纬度转变为具体的地址. Geocoding API的详细介绍参见:http://developer.baidu.com/map/web ...
- OK335xS EMMC Partition hacking
#! /bin/sh # # OK335xS EMMC Partition hacking # 说明: # 本文主要是为了解读同事对EMMC分区的写法,其中有很多写法重复了,但 # 依然尽量保留其作者 ...
- 手动启动angular
关于手动启动 angular 的问题 angular核心原理解析1:angular自启动过程 angular.element(document).ready(function() { angular. ...