Skip to content

1086 就不告诉你

做作业的时候,邻座的小盆友问你:“五乘以七等于多少?”你应该不失礼貌地围笑着告诉他:“五十三。”本题就要求你,对任何一对给定的正整数,倒着输出它们的乘积。

53.jpg

输入格式:

输入在第一行给出两个不超过 1000 的正整数 A 和 B,其间以空格分隔。

输出格式:

在一行中倒着输出 A 和 B 的乘积。

输入样例:

tex
5 7
5 7

输出样例:

tex
53
53

Solution:

java
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        long Product = a * b;
        String s = "";
        String Product_new = String.valueOf(Product);
        for (int i=0;i<Product_new.length();i++)
        {
            long x = Product % 10;
            Product = Product / 10;
            s = s + String.valueOf(x);
        }
        System.out.println(Integer.parseInt(s));
    }
}
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        long Product = a * b;
        String s = "";
        String Product_new = String.valueOf(Product);
        for (int i=0;i<Product_new.length();i++)
        {
            long x = Product % 10;
            Product = Product / 10;
            s = s + String.valueOf(x);
        }
        System.out.println(Integer.parseInt(s));
    }
}

Released under the MIT License.