/ Randle /

记录详情

Wrong Answer

/in/foo.cc: In function 'int main()':
/in/foo.cc:13:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<strlen(a);i++)
          ~^~~~~~~~~~
/in/foo.cc:31:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<strlen(s);i++)
          ~^~~~~~~~~~
/in/foo.cc:37:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<strlen(s);i++)
          ~^~~~~~~~~~
# 状态 耗时 内存占用
#1 Accepted 3ms 376.0 KiB
#2 Accepted 3ms 380.0 KiB
#3 Accepted 3ms 352.0 KiB
#4 Accepted 3ms 360.0 KiB
#5 Wrong Answer 3ms 380.0 KiB
#6 Accepted 3ms 344.0 KiB
#7 Accepted 3ms 372.0 KiB
#8 Accepted 4ms 380.0 KiB
#9 Accepted 3ms 340.0 KiB
#10 Accepted 3ms 360.0 KiB

代码

#include <bits/stdc++.h>
using namespace std;
char a[1001],b[1001],s[1001];
int change[30];
int v[30]={0};
int main()
{
	//freopen("enc.in","r",stdin);
	//freopen("enc.out","w",stdout);
	int i;
	scanf("%s %s %s",b,a,s);
	memset(change,-1,sizeof(change));
	for(i=0;i<strlen(a);i++)
	{
		if(change[a[i]-'a']==-1)
		{
			if(!v[b[i]-'a'])
				change[a[i]-'a']=b[i]-'a',v[b[i]-'a']=1;
			else
			{
				cout<<"ERROR";
				return 0;
			}
		}
		else if(change[a[i]-'a']!=b[i]-'a')
		{
			cout<<"ERROR";
			return 0;
		}
	}
	for(i=0;i<strlen(s);i++)
		if(change[s[i]-'a']==-1)
		{
			cout<<"ERROR";
			return 0;
		}
	for(i=0;i<strlen(s);i++)
		printf("%c",change[s[i]-'a']+'a');
	return 0;
}

信息

递交者
类型
递交
题目
字符串问题 T1
题目数据
下载
语言
C++
递交时间
2017-10-19 19:47:35
评测时间
2017-10-19 19:47:35
评测机
分数
90
总耗时
35ms
峰值内存
380.0 KiB