Snow_maple


私信TA

用户名:2016114438

访问量:21035

签 名:

我喜欢一个人,她叫鞠婧祎!

等  级
排  名 252
经  验 5820
参赛次数 2
文章发表 32
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

/*
将每个数字的灯亮表示1,灯灭表示0,转换时不相同就加1 例如1-2,有5个不相同。
*/
#include<iostream>
using namespace std;
typedef struct{
	int up,mid,down,l_up,l_down,r_up,r_down;
}T;
int main(){
	T t[11];
	int m=0,n;
	cin>>n;
	string a,b;
	cin>>a>>b;
	t[0]={1,0,1,1,1,1,1};
	t[1]={0,0,0,0,0,1,1};
	t[2]={1,1,1,0,1,1,0};
	t[3]={1,1,1,0,0,1,1};
	t[4]={0,1,0,1,0,1,1};
	t[5]={1,1,1,1,0,0,1};
	t[6]={1,1,1,1,1,0,1};
	t[7]={1,0,0,0,0,1,1};
	t[8]={1,1,1,1,1,1,1};
	t[9]={1,1,1,1,0,1,1};
	for(int i=0;i<n;i++){
		int c=a[i]-'0';
		int d=b[i]-'0';
        if(t[c].up!=t[d].up) m++;
        if(t[c].down!=t[d].down) m++;
        if(t[c].l_up!=t[d].l_up) m++;
        if(t[c].l_down!=t[d].l_down) m++;
        if(t[c].r_up!=t[d].r_up) m++;
        if(t[c].r_down!=t[d].r_down) m++;
        if(t[c].mid!=t[d].mid) m++;
	}
	cout<<m<<endl;
	return 0;
}






注意事项:





参考代码:

 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区