Apple Pen Gym - 102680B
https://vjudge.net/problem/Gym-102680B/origin
https://vjudge.net/contest/396206#problem/B
After visiting the Apple store and playing with the new iPad Pro, many are hopelessly attracted to having their own Apple Pencil. However, because Apple Pencils have been brutally trademarked and are obscenely expensive, such visitors must settle for a compromise: making an Apple-Pen! Apple-Pens can be created by uh-ing a Pen with an Apple (uh-ing an Apple with a Pen would create a Pen-Apple, which, of course, is not nearly as cool). It has recently been discovered that this uh function can be applied to things other than apples and pens! Uhing item A with item B will create a new item: B-A. Given 2*n items, what will result when each pair of items are uhed?
Input
The first line will contain a single integer n, the number of times to perform the uh operation.
2*n lines follow. Each line will contain a sentence of the form "I have a <item>" where <item> is replaced by a single word of upper case letters, lower case letters, and hyphens (-), but not spaces.
1≤n≤10001≤n≤1000
1≤charactersPerItemName≤10001≤charactersPerItemName≤1000
Output
Output n lines each of the form "Uh! <item b>-<item a>!" where "<item b>" and "<item a>" are replaced by their respective items.
Example
2
I have a Apple
I have a Pen
I have a Apple-Pen
I have a Pen-Pineapple
Uh! Pen-Apple!
Uh! Pen-Pineapple-Apple-Pen!
Note
There are two test cases. In the first, an Apple is uhed with a Pen to create an Pen-Apple.
Sponsor
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include <vector>
#include <iterator>
#include <utility>
#include <sstream>
#include <limits>
#include <numeric>
#include <functional>
using namespace std;
#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
#define debug(x) cout<<"debug:"<<#x<<" = "<<x<<endl; #define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef char ch;
typedef double db; const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=0x3f3f3f3f;
//const int maxn=1e5+10;
const int maxn = 5010;
//const int maxm=100+10;
const int N=1e6+10;
const int mod=1e9+7; ch c1[1000] = {0};
ch c2[1000] = {0};
ch c0[1000] = {0};
int main()
{
int t = 0;
cin >> t;
while(t--)
{
cin >> c0 >> c0 >> c0 >> c1;
cin >> c0 >> c0 >> c0 >> c2;
cout << "Uh! ";
for(int j = 0;c2[j]!='\0';j++)
{
cout << c2[j];
}
cout << "-";
for(int i = 0;c1[i]!='\0';i++)
{
cout << c1[i];
}
cout << "!" << endl;
}
return 0;
}
Apple Pen Gym - 102680B的更多相关文章
- 自定义基于 VLC 的视频播放器
前言(蛋疼的背景故事) 前段时间,接了一个小项目,有个需求是要在系统待机一段时间以后,循环播放 MV(类似于 Windows 系统的屏幕保护). 听到这个需求,我首先想到的是 MediaPlayer ...
- Weekly Traning Farm 16
先安利一下这套比赛,大概是doreamon搞的,每周五晚上有一场,虽然没人做题目质量挺高的 http://codeforces.com/group/gRkn7bDfsN/contests(报名前要先报 ...
- [LeetCode] Word Break II 拆分词句之二
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each ...
- [LeetCode] Word Break 拆分词句
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separa ...
- Python 字符串分割的方法
在平时工作的时候,发现对于字符串分割的方法用的比较多,下面对分割字符串方法进行总结一下:第一种:split()函数split()函数应该说是分割字符串使用最多的函数用法:str.split('分割符' ...
- GJM :自定义基于 VLC 的视频播放器 [转载]
感谢您的阅读.喜欢的.有用的就请大哥大嫂们高抬贵手"推荐一下"吧!你的精神支持是博主强大的写作动力以及转载收藏动力.欢迎转载! 版权声明:本文原创发表于 [请点击连接前往] ,未经 ...
- java操作AJAX
1,get方式的AJAX function sendAjaxReq() { //1,创建ajax引擎 XMLHttpRequest对象 var req = new XMLHttpRequest() | ...
- LeetCode Word Break II
原题链接在这里:https://leetcode.com/problems/word-break-ii/ 题目: Given a string s and a dictionary of words ...
- Shell中map的使用
Shell中的map与array有很多的相似之处,array操作:https://www.cnblogs.com/qq931399960/p/10786111.html 一.在使用map时,需要先声明 ...
- Shell中数组的使用
数组是一个很有用的数据结构,经常使用的功能有初始化,遍历,查找,获取数组长度等操作 一.初始化 小括号中使用空格分开的数据结构就是一个数组,也可使用下标添加元素 arr=(1 'nice' '2day ...
随机推荐
- 解决VMware虚拟机安装centos无法联网问题
网上的教程几乎试了个遍,最后使用该方法成功解决. 用终端进入目录:/etc/sysconfig/network-scripts 执行ls命令查看以"ifcfg-en"开头的文件,例 ...
- Java 异常处理try、catch、finally和return执行顺序
目录 问题背景 finally语句一定执行吗 finally语句与return的执行顺序 问题分析 1. finally语句在f()执行之后.y返回之前执行 2. finally块中的return语句 ...
- 使用 frp 搭建 https 服务
踩了许多坑,特此记录一下 1.首先服务端的配置(yaml) # 服务端监听本机的 7000 和 443 端口 bindPort: 7000 # 用于 frp 客户端连接 vhostHTTPSPort: ...
- EasyExcel读取多个sheet表数据,自定义监听器
接口 /** * 导入 * * @param file * @return */ @PostMapping("/waitimport") public Result waitImp ...
- Keil watch中数据不更新解决办法
watch数据不更新解决办法 在使用keil的watch窗口观察寄存器里面的值进行调试时,有时候里面的值就是不会更新,经测试打开View中最下面的那个按键即可
- 【服务器备份方案】基于Duplicati+Alist+阿里云盘的备份方案
服务器备份方案 该博文转载自我的个人博客:小树 | 服务器备份方案 前言 在我们实际的生产环境中,由于云服务存在很多的不稳定性,因此对服务器进行定时备份就很有必要了. 虽然部分服务器厂商提供了快照备份 ...
- cuda grid block size
编译命令:nvcc hello.cu -o hello 运行:./hello #include <stdio.h> __global__ void helloWorldKernel() { ...
- 前端技术栈加持:用 SpreadJS 实现分权限管理
引言 在现代前端开发中,数据表格的应用极为广泛,而分权限管理在许多业务场景下是必不可少的功能.例如在表格类填报需求中,不同等级的登录用户能填报的区域有所不同.SpreadJS 作为一款强大的前端表格控 ...
- Spring Boot 自动配置原理深度解析
在 Spring 生态系统中,Spring Boot 自动配置是实现 "零配置" 开发的核心特性,通过约定大于配置的理念,自动为应用注入所需的基础设施配置.本文从核心注解.底层机制 ...
- Vertx Mysql数据库优化 (七)
项目github地址:https://github.com/fotocj007/VertxWebApi 前一章节完成了mysql客户端的链接和基本重新,每次重新都需要写sql语句,这章优化一下mysq ...