zoukankan      html  css  js  c++  java
  • 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 }
  • 相关阅读:
    单列模式
    经济数据价格走势图(包括纸黄金),可以查看历史
    UVA10010的类似BFS做法
    转:数据结构专项之Hash函数
    ZOJ1709 DFS和BFS两种搜索方法
    HDU1969(二分搜索)
    HDU1045 回溯
    HDU2899(三分搜索)
    安神口中的水题
    HDU2199(二分搜索无限逼近)
  • 原文地址:https://www.cnblogs.com/liuyangfirst/p/6544508.html
Copyright © 2011-2022 走看看