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. ajax实现md5加密

    一个asp.net ajax例子,使用jquery,实现md5加密..NET 4.0,Visual Studio 2010以上.效果体验:http://tool.keleyi.com/t/md5.ht ...

  2. 骑士周游问题 --- 递归解法 --- java代码

    骑士游历: 定义了向量的数组M,行数组X,列数组Y, 棋盘plane,计数器count,走动步数step 需要注意的是,递归函数的进入前的验证,原先的想法是传入来时的方向参数,可是这样的想法被实践否定 ...

  3. 20+富有创意的BuddyPress网站

    如果你想构建自己的社区网站,如果你熟悉WordPress,那么用BuddyPress构建它吧!它确实太强大了,本文整理了20个富有创意的BuddyPress网站,看看它们,你也能拥有! 原文地址:ht ...

  4. Struts2文件下载

    1). Struts2 中使用 type="stream" 的 result 进行下载 2). 可以为 stream 的 result 设定如下参数 contentType: 结果 ...

  5. error日志

    2016/06/15 微信调核心时通用意外险 2016-06-15 11:44:23,771>>INFO >> com.isoftstone.core.service.comm ...

  6. Labview中定时函数之间的区别

    第一个定时函数(时间延迟):在VI中插入时间延迟,指定在运行调用VI之前延时的秒数.默认值为1.000. 第一个定时函数(等待(ms)):等待指定长度的毫秒数,并返回毫秒计时器的值.该函数进行异步系统 ...

  7. AVAST 4.8

    AVAST专业版注册序列号不能用了就换一个继续注册,接着用序列号:S9665355R9665P1106-YCX4AKKT (2012.5.3)S7592769R8591F1106-ZVDJPMLT ( ...

  8. git 安装与使用场景

    1. 安装 yum install git #自动安装依赖 centos sudo apt-get install git #ubutu http://msysgit.github.io/ #wind ...

  9. java使用jdbc对sqlite 添加、删除、修改的操作

    package com.jb.jubmis.Dao.DaoImpl; import java.io.File;import java.io.FileInputStream;import java.io ...

  10. 创建类模式(五):单例(Singleton)

    定义 确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例. 单例模式一般情况下通过使用private的构造函数确保了在一个应用中只产生一个实例,并且是自行实例化. 和静态变量的区别 虽然 ...