zoukankan      html  css  js  c++  java
  • Apple Pen Gym

    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.

    1n10001≤n≤1000

    1charactersPerItemName10001≤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

    Input
    2
    I have a Apple
    I have a Pen
    I have a Apple-Pen
    I have a Pen-Pineapple
    
    Output
    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]!='';j++)
    		{
    			cout << c2[j];
    		}
    		cout << "-";
    		for(int i = 0;c1[i]!='';i++)
    		{
    			cout << c1[i];
    		}
    		cout << "!" << endl;
    	}
    	return 0;
    }
    

      

  • 相关阅读:
    JavaScript String常用方法和属性
    JavaScript null 和 undefined
    document.write()
    MyBatis中的@MapKey注解
    Zookeeper实现分布式锁
    zookeeper相关
    二阶段提交和三阶段提交
    代理模式
    模板方法模式
    策略模式
  • 原文地址:https://www.cnblogs.com/SutsuharaYuki/p/13813511.html
Copyright © 2011-2022 走看看