Problem L: CreatorX背英语
Time Limit: 1 Sec Memory Limit: 64 MB
Submit: 53 Solved: 36
[Submit][Status][Web Board]
Description
CreatorX最近在忙着背英语, Hzk is a young and beautiful and cute boy 但是正常背诵的效果他觉得不好,于是他又想了一个点子,倒着背。 Boy cute and beautiful and young a is Hzk 现在给他给你一个只包含大小写字母和逗号(逗号替代空格)的英文句子,单词被一个逗号隔开,让你跟着一起倒着背出来, Input
第一行一个数字T代表测试的组数。(T<=20) 对于每组测试一行只由大小写字母和逗号组成字符串s(0<|s|<=2000),保证没有连着的逗号,而且句子的第一个字母和最后一个字母不是逗号. Output
对于每组测试输出一行,把句子以单词为单位倒着输出. Sample Input
2
Hzk,is,a,young,and,beautiful,and,cute,boy
abc,def
Sample Output
boy,cute,and,beautiful,and,young,a,is,Hzk
def,abc
HINT 这也要hint吗QaQ 还是要的,输入的时候最好不要用getchar(),由于环境问题可能会出奇奇怪怪的错误。
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <map>
#include <bitset>
#include <set>
#include <vector>
#include <sstream>
using namespace std; const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const double eps = 1e-15;
typedef long long ll;
typedef pair <int, int> PLL;
vector<string> v; int main()
{
int t;
cin>>t;
t++;
while(t--)
{
string s,buf;
getline(cin,s); stack<string> st;
while( !st.empty() )
st.pop(); for(int i=0;i<s.size();i++)
{
if(s[i]==',') s[i]=' ';
}
int k=0;
stringstream ss(s);
while(ss>>buf)
{
st.push(buf);
k++;
} int f=0;
while(!st.empty())
{
f++;
if(f == k) {
cout<<st.top()<<endl;
}
else
cout<<st.top()<<",";
st.pop();
}
}
}

华农oj Problem L: CreatorX背英语【STL】的更多相关文章

  1. 华农oj Problem K: 负2进制【有技巧构造/待补】

    Problem K: 负2进制 Time Limit: 2 Sec Memory Limit: 128 MB Submit: 51 Solved: 6 [Submit][Status][Web Boa ...

  2. 华农oj Problem B: Averyboy找密码【STL】

    Problem B: Averyboy找密码 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 83 Solved: 29 [Submit][Status] ...

  3. 华农oj Problem J: 幻化【贪心/抽屉原理】

    Problem J: 幻化 Time Limit: 2 Sec Memory Limit: 128 MB Submit: 18 Solved: 3 [Submit][Status][Web Board ...

  4. 华农oj 2192: hzk又在打人【CRT合并/待补】

    2192: hzk又在打人 Time Limit: 12 Sec Memory Limit: 512 MB Submit: 52 Solved: 1 [Submit][Status][Web Boar ...

  5. Problem L

    Problem Description 在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数. 例如n=3时,为2× 3方格,骨牌的铺放方案有三种,如下图: L&qu ...

  6. The Ninth Hunan Collegiate Programming Contest (2013) Problem L

    Problem L Last Blood In many programming contests, special prizes are given to teams who solved a pa ...

  7. 华农js抢课神器

    又到了华农选课的时候,服务器估计就受不了,每天奔溃几次,这次选课贪心了点,竟然选了5门,好吧,我承认我只中了1门,什么??刚刚换课给同学马上就被人抢了?我来告诉你原因吧,最近发现一位大神写了一份js脚 ...

  8. Gym 102056L - Eventual … Journey - [分类讨论][The 2018 ICPC Asia-East Continent Final Problem L]

    题目链接:https://codeforces.com/gym/102056/problem/L LCR is really an incredible being. Thinking so, sit ...

  9. 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem L. Stock Trading Robot 水题

    Problem L. Stock Trading Robot 题目连接: http://www.codeforces.com/gym/100253 Description CyberTrader is ...

随机推荐

  1. 《Cracking the Coding Interview》——第3章:栈和队列——题目6

    2014-03-19 03:01 题目:给定一个栈,设计一个算法,在只使用栈操作的情况下将其排序.你可以额外用一个栈.排序完成后,最大元素在栈顶. 解法:我在草稿纸上试了试{1,4,2,3}之类的小例 ...

  2. Caliburn Micro Binding KeyDown Event

    <TextBox x:Name="MyTextBox" TextAlignment="Left" FontSize="10" Widt ...

  3. 【Spiral Matrix II】cpp

    题目: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. ...

  4. Http状态码枚举(摘自 Microsoft 程序集 System.dll)

    // 摘要: // 包含为 HTTP 定义的状态代码的值. public enum HttpStatusCode { // 摘要: // 等效于 HTTP 状态 100. System.Net.Htt ...

  5. cannot bind to 127.0.0.1:5037 报错

    使用appium连接真机时,提示这个错误,找了很久,发现是端口被占用 打开cmd,netstat -nao查看当前的TCP连接,找到使用127.0.0.1:5037的代码,然后到任务管理器查看详细进程 ...

  6. Jmeter微信小程序接口测试

    最近公司新项目组开发一款微信小程序电商平台,为了更好保证产品质量,因此提出了需要进行接口测试. 从接口本身来讲,对其测试与其他项目应该是一样的.所以不难理解,我们要对小程序的接口测试需要准备的 材料有 ...

  7. 社区版pycharm安装Django框架

    1.cmd下执行:pip3 install django 2.cmd下执行:django-admin startproject Demo (Demo为项目名称,可以更改你取的项目名称) 3.cmd下执 ...

  8. python-使用pip安装第三方库报UnicodeDecodeError: 'utf8' codec can't decode byte 0xcb in position 7: invalid continuation byte 错误解决方案

    在python 的安装目录下找到Lib\ntpath.py文件,找到def join(path, *paths):方法,添加如下两行语句: reload(sys) sys.setdefaultenco ...

  9. nyoj 题目21 三个水杯

    三个水杯 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 给出三个水杯,大小不一,并且只有最大的水杯的水是装满的,其余两个为空杯子.三个水杯之间相互倒水,并且水杯没有 ...

  10. 详解Linux运维工程师应具备的十大技能

    Linux系统如果是学习可以选用Redhat或CentOS,特别是CentOS在企业中用得最多,当然还会有其它版本的,但学习者还是以这2个版本学习就行,因为这两个版本都是兄弟,没区别的,有空可以再研究 ...