美文网首页
HDU 2075 A|B?

HDU 2075 A|B?

作者: itbird01 | 来源:发表于2022-04-13 07:02 被阅读0次

Problem Description
正整数A是否能被正整数B整除,不知道为什么xhd会研究这个问题,来帮帮他吧。

Input

输入数据的第一行是一个数据T,表示有T组数据。
每组数据有两个正整数A和B(A,B<10^9)。

Output
对于每组输入数据,输出"YES"表示可以被整除,"NO"表示不能被整除。

Sample Input

2 4 2 5 3

Sample Output

YES NO

java code

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        for (int i = 0; i < n; i++) {
            double a = input.nextDouble();
            double b = input.nextDouble();
            if (a % b == 0) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
        input.close();
    }

}```

相关文章

网友评论

      本文标题:HDU 2075 A|B?

      本文链接:https://www.haomeiwen.com/subject/mfbtsrtx.html