42 :809*x=800*x+9*x+1

题目:809*x=800*x+9*x+1(去掉最后的1有解)
其中x代表的两位数,8*x的结果为两位数,9*x的结果为3位数.求x代表的两位数,及809*x后的结果(两种方法实现)

 1    public class _042PrintResult {
 2 
 3     public static void main(String[] args) {
 4         printResult();
 5         printResult2();
 6     }
 7 
 8     private static void printResult2() {
 9         boolean flag = false;
10         int total_01 = 0, total_02 = 0, i = 10;
11         for (; i < 100; i++) {
12             total_01 = 809 * i;
13             total_02 = 800 * i + 9 * i + 1;
14             if ((8 * i) / 10 > 0 && (8 * i) / 10 < 10) { // 8*??的结果为两位数
15                 if ((9 * i) / 100 > 0 && (9 * i) / 100 < 10) { // 9*??的结果为三位数
16                     if (total_01 == total_02) {
17                         flag = true;
18                     }
19                 }
20             }
21         }
22 
23         if (flag) {
24             System.out.println("该两位数为:" + i);
25             System.out.println("809*i = " + 809 * i);
26         } else {
27             System.out.println("无符合要求的数");
28         }
29     }
30 
31     private static void printResult() {
32         int a = 809, b, i;
33         for (i = 10; i < 13; i++) {
34             b = i * a;
35             if (8 * i < 100 && 9 * i >= 100) {
36                 System.out.println("809*" + i + "=" + "800*" + i + "+" + "9*"
37                         + i + "=" + b);
38             }
39         }
40     }
41 
42 }
原文地址:https://www.cnblogs.com/liuyangfirst/p/6544508.html