首页 > 分享 > 赛软件 * 比赛 = 软件比拼

赛软件 * 比赛 = 软件比拼

下列乘法算式中:每个汉字代表1个数字(1~9)。相同的汉字代表相同的数字,不同的汉字代表不同的数字。

    赛软件 * 比赛  =  软件比拼

程序代码:

#include<iostream>

using namespace std;

void fun(int a[],int n);

int main()

{

int a,b,c,d,e;

int arr[10]= {0};

int x,y;

for(int i = 100;i <= 999; ++i)

{

for(int j = 10;j <= 99; ++j)

{

y = 0;

x = i * j;

if(x < 1000 || x > 9999) break;

a = i / 100;

arr[a] = 1;

if(a != j % 10 )

{

fun(arr,10);

continue;

}

b = i / 10 % 10;

arr[b] = 1;

if(b != x / 1000 )

{

fun(arr,10);

continue;

}

c = i % 10;

arr[c] = 1;

if(c != (x / 100 % 10) )

{

fun(arr,10);

continue;

}

d = j / 10;

arr[d] = 1;

if(d != (x / 10 % 10) )

{

fun(arr,10);

continue;

}

e = x % 10;

arr[e] = 1;

for(int k = 0;k < 10; ++k)

{

y += arr[k];

}

if(5 == y)

{

cout<<i<<" * "<<j<<" = "<<x<<endl;

}

fun(arr,10);

}

}

return 0;

}

void fun(int a[],int n)

{

for(int l = 0;l < n; ++l)

{

a[l] = 0;

}

}


运行结果:

465 * 14 = 6510

相关知识

赛软件*比赛=软件比拼源程序
医疗器械软件(医用软件)行业报告
要让各种“水赛”获奖证书成废纸丨时评
Garden Planner 园林设计软件软件下载
种植软件哪个好
【园林设计软件】YLCAD园林景观设计软件 8.0
60元就能换来一张“国际竞赛”获奖证书 记者调查“水赛”等山寨赛事乱象
第八届蓝桥杯全国软件和信息技术专业人才大赛报名指南
养花软件推荐 种植花束软件推荐
园林设计软件

网址: 赛软件 * 比赛 = 软件比拼 https://m.huajiangbk.com/newsview389171.html

所属分类:花卉
上一篇: 可爱小熊logo图片
下一篇: Protecting the F