I am Lord Voldemort

Time Limit: 20 Sec  Memory Limit: 256 MB

题目连接

http://acm.uestc.edu.cn/#/problem/show/71

Description

f you have ever read Harry Potter, you would know that the evil and powerful wizard, Lord Voldemort, create this name by permuting his original name, Tom Marvolo Riddle, to I am Lord Voldemort.

Write a program to check whether it is possible to transform a given word to another by permuting its letters.

The length of any given word is greater than 0 and no larger than 50.

Input

The first line is an integer T, the number of test cases. Following T lines each contains two words separated by spaces.

Output

For each test case, Output on a line Yes if it is possible to do the transformation, otherwise output No instead.

Permuting a word is to change the order of its letters, but no new letters can be added and no original letters can be deleted. For example, one can transform aabc to abca, but not to bac, abc, aabca, aacbb.

Words will contain letters only(a-z, A-Z).

A word won't contain any white spaces in itself.

The given two words will not be the same.

You should ignore case when comparing words, i.e. a is the same as A, b is the same as B, etc.

Sample Input

4
TomMarvoloRiddle IamLordVoldemort
stop pots
abbc bac
InternetAnagramServer IRearrangementServant

Sample Output

Yes
Yes
No
Yes

HINT

题意

题解:

傻逼题

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
#define maxn 200000
#define mod 10007
#define eps 1e-9
int Num;
char CH[];
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
inline void P(int x)
{
Num=;if(!x){putchar('');puts("");return;}
while(x>)CH[++Num]=x%,x/=;
while(Num)putchar(CH[Num--]+);
puts("");
}
//************************************************************************************** string s1,s2;
map<char,int> H;
int main()
{
//test;
int t=read();
while(t--)
{
H.clear();
cin>>s1>>s2;
for(int i=;i<s1.size();i++)
{
if(s1[i]>='A'&&s1[i]<='Z')
s1[i]=s1[i]-'A'+'a';
H[s1[i]]++;
}
int flag=;
if(s1.size()!=s2.size())
flag=;
for(int j=;j<s2.size();j++)
{
if(s2[j]>='A'&&s2[j]<='Z')
s2[j]=s2[j]-'A'+'a';
if(!flag)
break;
if(!H[s2[j]])
{
flag=;
break;
}
else
H[s2[j]]--;
}
if(flag)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
}

cdoj 71 I am Lord Voldemort 水题的更多相关文章

  1. cdoj 24 8球胜负(eight) 水题

    8球胜负(eight) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/24 ...

  2. cdoj 03 BiliBili, ACFun… And More! 水题

    Article Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/3 Descr ...

  3. cdoj 26 遮挡判断(shadow) 水题

    遮挡判断(shadow) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/26 ...

  4. poj 1003:Hangover(水题,数学模拟)

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 99450   Accepted: 48213 Descri ...

  5. Identity Card(水题)

    Identity Card Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) To ...

  6. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  7. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  8. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  9. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

随机推荐

  1. 关于Cygwin的x-Server的自动运行以及相关脚本修改

    常常需要用到远端服务器的图形工具,如果在windows端没用xserver的话,很多程序无法运行.一个特殊的例子,emacs在没用xserver的时候,是直接在终端中打开的,如果不修改cygwin.b ...

  2. NewtonPrincipia --- 公理或运动的定律 --- 系理二

    NewtonPrincipia --- 公理或运动的定律 --- 系理二 自然哲学的数学原理>公理或运动的定律>系理II 平行四边形ABCD,那么:直接的力AD由任意的力AB和BD合成,直 ...

  3. KMP算法的代码实现

    上周算法班的BEN老师花了1个小时讲自动机和KMP的关系,结果failed...明天又要上课了,花了半天时间看了下KMP,暂且停留在利用next求模式中的跳跃长度,自动机那个还不能理解... 具体的可 ...

  4. motan源码解读:注册中心zookeeper(1)

    Apache ZooKeeper is an effort to develop and maintain an open-source server which enables highly rel ...

  5. phpcms的增删改查操作整理

    一.查 ①select($where = '', $data = '*', $limit = '', $order = '', $group = '', $key='') /** * 执行sql查询 ...

  6. ASP.NET MVC3 系列教程 - 部署你的WEB应用到IIS 6.0

    I:ASP.NET MVC3 部署的前期工作 1.确认部署的服务器操作系统环境 首先我们确认服务器的操作系统版本 可以从系统命令行工具里输入: systeminfo 获取相关操作系统信息例如 然后再确 ...

  7. mongdb创建自增主键(primary key)的相关讨论 - Jason.Zhi

    根据mongodb官方文档介绍,如果在插入(insert)操作时,没有指定主键id,那么它会自动给插入行自动附上一个主键id.看起来不错,但是详细看看,就会发现这个id值有点复杂. 如下图: mong ...

  8. poj 3299 Humidex

    直接套公式就可以,可我套公式第一遍都错了,英语差的孩子伤不起(┬_┬) #include <iostream> #include <cmath> #include <io ...

  9. 了解shell

    1. shell 脚本文件第一行:    #!/bin/sh 或 #!/bin/bash "#!"  又称为纪数,在执行bash脚本的时候,内核会根据它来确定该用哪个程序来解释脚本 ...

  10. 基于jquery的表格动态创建,自动绑定,自动获取值

    最近刚加入GUT项目,学习了很多其他同事写的代码,感觉受益匪浅. 在GUT项目中,经常会碰到这样一个问题:动态生成表格,包括从数据库中读取数据,并绑定在表格中,以及从在页面上通过jQuery新增删除表 ...