acDream


私信TA

用户名:acDream

访问量:31984

签 名:

欢迎光临CSDN博客https://blog.csdn.net/acDream_

等  级
排  名 138
经  验 7288
参赛次数 4
文章发表 72
年  龄 0
在职情况 学生
学  校 黑龙江工商学院
专  业 软件工程

  自我简介:

欢迎光临CSDN博客https://blog.csdn.net/acDream_

解题思路:

注意事项:

参考代码:

public class 检查金币 {


public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner in = new Scanner(System.in);

while (in.hasNext()) {

int W = in.nextInt();

for (int a = 9; a < 12; a++) {

for (int a1 = 9; a1 < 12; a1++) {

for (int a2 = 9; a2 < 12; a2++) {

for (int a3 = 9; a3 < 12; a3++) {

for (int a4 = 9; a4 < 12; a4++) {

for (int a5 = 9; a5 < 12; a5++) {

for (int a6 = 9; a6 < 12; a6++) {

for (int a7 = 9; a7 < 12; a7++) {

for (int a8 = 9; a8 < 12; a8++) {

for(int a9 = 9;a9<12;a9++) {

if((int)Math.pow(3,0)*a+(int)Math.pow(3,1)*a1+(int)Math.pow(3,2)*a2+(int)Math.pow(3,3)*a3+(int)Math.pow(3,4)*a4+(int)Math.pow(3,5)*a5+(int)Math.pow(3,6)*a6+(int)Math.pow(3,7)*a7+(int)Math.pow(3,8)*a8+(int)Math.pow(3,9)*a9==W) {

System.out.println(a+" "+a1+" "+a2+" "+a3+" "+a4+" "+a5+" "+a6+" "+a7+" "+a8+" "+a9);

}

}

}

}

}

}

}

}

}

}

}

}

}


}


 

0.0分

1 人评分

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

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区