类似填空题:
①算式900:
https://blog.csdn.net/s44Sc21/article/details/132746513?spm=1001.2014.3001.5501https://blog.csdn.net/s44Sc21/article/details/132746513?spm=1001.2014.3001.5501
②九宫幻方③七星填数④幻方填空:https://blog.csdn.net/s44Sc21/article/details/132429826?spm=1001.2014.3001.5501https://blog.csdn.net/s44Sc21/article/details/132429826?spm=1001.2014.3001.5501
⑤纸牌三角形:
https://blog.csdn.net/s44Sc21/article/details/132784482?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132784482%22%2C%22source%22%3A%22s44Sc21%22%7Dhttps://blog.csdn.net/s44Sc21/article/details/132784482?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132784482%22%2C%22source%22%3A%22s44Sc21%22%7D
⑥搭积木:
https://blog.csdn.net/s44Sc21/article/details/132840321?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132840321%22%2C%22source%22%3A%22s44Sc21%22%7Dhttps://blog.csdn.net/s44Sc21/article/details/132840321?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132840321%22%2C%22source%22%3A%22s44Sc21%22%7D⑦五星填数:
https://blog.csdn.net/s44Sc21/article/details/132839777?spm=1001.2014.3001.5502https://blog.csdn.net/s44Sc21/article/details/132839777?spm=1001.2014.3001.5502
⑧方格填数:https://blog.csdn.net/s44Sc21/article/details/132890408?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132890408%22%2C%22source%22%3A%22s44Sc21%22%7Dhttps://blog.csdn.net/s44Sc21/article/details/132890408?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132890408%22%2C%22source%22%3A%22s44Sc21%22%7D
⑨三羊献瑞:
https://blog.csdn.net/s44Sc21/article/details/132892728?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132892728%22%2C%22source%22%3A%22s44Sc21%22%7Dhttps://blog.csdn.net/s44Sc21/article/details/132892728?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22132892728%22%2C%22source%22%3A%22s44Sc21%22%7D
⑩反幻方:
https://blog.csdn.net/s44Sc21/article/details/133189696?spm=1001.2014.3001.5502https://blog.csdn.net/s44Sc21/article/details/133189696?spm=1001.2014.3001.5502
···
四阶幻方
蓝桥杯官网填空题(四阶幻方)_s44Sc21的博客-CSDN博客https://blog.csdn.net/s44Sc21/article/details/133659614?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22133659614%22%2C%22source%22%3A%22s44Sc21%22%7D
填算式
https://blog.csdn.net/s44Sc21/article/details/133828415?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22133828415%22%2C%22source%22%3A%22s44Sc21%22%7Dhttps://blog.csdn.net/s44Sc21/article/details/133828415?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22133828415%22%2C%22source%22%3A%22s44Sc21%22%7D
=========================================================
题目描述
本题为填空题,只需要算出结果后,在代码中使用输出语句将所填结果输出即可。
B DEF
A + --- + ------- = 10
C GHI
这个算式中 A ~ I 代表 0 ~ 9 的数字,不同的字母代表不同的数字。
比如: 6+8/3+952/714 就是一种解法,5+3/1+972/486 是另一种解法。文章来源:https://www.toymoban.com/news/detail-701455.html
这个算式一共有多少种解法?文章来源地址https://www.toymoban.com/news/detail-701455.html
运行限制
- 最大运行时间:1s
- 最大运行内存: 128M
import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改
public class Main {
static int[] a=new int[9];
static int[] biaoji=new int[10];
static int ans=0;
static int flag=0;
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//在此输入您的代码...
scan.close();
dfs(0);
System.out.println(ans);
}
public static void dfs(int n){
if(n==9){
int A=a[0];
int B=a[1];
int C=a[2];
int D=a[3]*100+a[4]*10+a[5];
int E=a[6]*100+a[7]*10+a[8];
if((A+B*1.0/+C+D*1.0/E)==10){
ans++;
return;
}
else{
return;
}
}
if(a[n]!=0){
dfs(n+1);
}
for(int i=1;i<=9;i++){
if(biaoji[i]==0&&a[n]==0){
biaoji[i]=1;
a[n]=i;
dfs(n+1);
biaoji[i]=0;
a[n]=0;
}
}
}
}
到了这里,关于蓝桥杯官网练习题(凑算式)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!