题目 2701: 取模

题目描述:

给定 n, m ,问是否存在两个不同的数 x, y 使得 1 ≤ x < y ≤ m 且 n mod x = n mod y 。

代码:

package lanqiao;

import java.math.BigInteger;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t -- != 0)
        {
            int n = sc.nextInt();
            int m = sc.nextInt();
            boolean tf = false;
            for(int x = 1;x <= m;x ++)
            {
                for(int y = 1;y < x;y ++){
                    if(x == y || n % x != n % y){
                        continue;
                    }
                    tf = true;
                    break;
                }
                if(tf)
                {
                    break;
                }
            }
            if(tf)
            {
                System.out.println("Yes");
                continue;
            }
            System.out.println("No");
        }
    }
}

相关推荐

  1. 题目 2701:

    2024-03-13 17:34:04       47 阅读
  2. C++求逆元、分数

    2024-03-13 17:34:04       47 阅读
  3. 关于的相关注意

    2024-03-13 17:34:04       25 阅读
  4. 2024美赛数学建所有题目思路分析

    2024-03-13 17:34:04       45 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-13 17:34:04       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-13 17:34:04       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-13 17:34:04       87 阅读
  4. Python语言-面向对象

    2024-03-13 17:34:04       96 阅读

热门阅读

  1. 2024年AI辅助研发:科技创新的引领者

    2024-03-13 17:34:04       43 阅读
  2. C#面:简单介绍枚举

    2024-03-13 17:34:04       47 阅读
  3. 3月12日做题总结(C/C++真题)

    2024-03-13 17:34:04       41 阅读
  4. Flask python 开发篇:配置文件

    2024-03-13 17:34:04       45 阅读
  5. Linux编程4.1 网络编程-前导

    2024-03-13 17:34:04       45 阅读
  6. Fastjson 1.2.24反序列化漏洞(Vulhub)使用方法

    2024-03-13 17:34:04       49 阅读
  7. Android硬件获取序列号sn适配Android9+

    2024-03-13 17:34:04       44 阅读
  8. HDFS面试重点

    2024-03-13 17:34:04       48 阅读
  9. 如何水文章:嚼口香糖是否会变瘦?

    2024-03-13 17:34:04       51 阅读