您的位置:首页 > 编程语言

NOIP模拟(20171026)T1 抄代码

2017-10-26 15:55 337 查看
题意——我不知道,我不知道,我不知道

反正判判就行了

怎么判?不知道不知道不知道……

#include<bits/stdc++.h>
using namespace std;
inline int getint(){
int x=0,p=1;
char c=getchar();
while(!isdigit(c)){
if(c=='-')p=-1;
c=getchar();
}
while(isdigit(c)){
x=(x<<3)+(x<<1)+(c^'0');
c=getchar();
}
return x*p;
}
inline void putint(long long x){
if(x<0){
x=-x;
putchar('-');
}
static int buf[30];
int tot=0;
do{
buf[tot++]=x%10;
x/=10;
}while(x);
while(tot)putchar(buf[--tot]+'0');
}
string s1,s2;
char c[30];
inline bool work(){

c055
memset(c,0,sizeof(c));
getline(cin,s1),getline(cin,s2);
int l1=s1.length(),l2=s2.length();
if(s1==s2)return true;
if(l1!=l2)return false;
for(int i=0;i<l1;++i){
if(s1[i]!=s2[i]){
if(s1[i]>'z'||s1[i]<'a')return false;
if(s2[i]>'z'||s2[i]<'a')return false;
}
if(s1[i]>'z'||s1[i]<'a')continue;
if(c[s1[i]-'a']){
if(c[s1[i]-'a']!=s2[i])return false;
}
else{
c[s1[i]-'a']=s2[i];
}
}
for(int i=0;i<26;++i){
if(!c[i])return true;
}
int tot[30];
memset(tot,0,sizeof(tot));
for(int i=0;i<26;++i){
++tot[c[i]-'a'];
}
for(int i=0;i<26;++i){
if(tot[i]!=1)return true;
}
return false;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string s;
getline(cin,s);
int t=0;
for(int i=0;i<s.length();++i){
if(!isdigit(s[i]))continue;
t=(t<<1)+(t<<3)+(s[i]^'0');
}
while(t--){
cout<<work()<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: