/ Randle /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 3ms 336.0 KiB
#2 Wrong Answer 3ms 324.0 KiB
#3 Wrong Answer 1ms 328.0 KiB
#4 Wrong Answer 2ms 332.0 KiB
#5 Wrong Answer 2ms 324.0 KiB
#6 Wrong Answer 1ms 320.0 KiB
#7 Wrong Answer 1ms 332.0 KiB
#8 Wrong Answer 1ms 324.0 KiB
#9 Wrong Answer 1ms 328.0 KiB
#10 Wrong Answer 1ms 332.0 KiB

代码

#include<bits/stdc++.h>
using namespace std;
string s1,s2,s3,s4;
int len,len2,a[26],v[26],t=0;
int main()
{
	freopen("enc.in.txt","r",stdin);
	freopen("enc.out.txt","w",stdout);
	memset(a,-1,sizeof(a));
	memset(v,0,sizeof(v));
	cin>>s1>>s2>>s3;
	len=s1.length();
	len2=s3.length();
	for(int i=0;i<len;i++)
	{
		if(a[s2[i]-'a']==-1&&!v[s1[i]-'a'])
		{
		    a[s2[i]-'a']=s1[i]-'a';
		    v[s1[i]-'a']=1;
		}
		else if(a[s2[i]-'a']==s1[i]-'a')
		continue;
		else {
			cout<<"1"<<endl;
			cout<<"ERROR"<<endl;
			exit(0);
		}
	}
	for(int i=0;i<len2;i++)
	{
		if(a[s3[i]-'a']!=-1)
		{
			s4[t++]=a[s3[i]-'a']+'a';
		}
		else {
			cout<<"2"<<endl;
			cout<<"ERROR"<<endl;
			return 0;
		}
	}
	for(int i=0;i<=t-1;i++)
	cout<<s4[i];
	cout<<endl;
	return 0;
}

信息

递交者
类型
递交
题目
字符串问题 T1
题目数据
下载
语言
C++
递交时间
2017-10-19 20:36:13
评测时间
2017-10-19 20:36:13
评测机
分数
0
总耗时
21ms
峰值内存
336.0 KiB