【蓝桥杯】一些有意思的题

同余方程组【消失的蓝宝】

消失的蓝宝 20553

解析参考 同余方程组章节

//法一
public class Main {
    public static void main(String[] args) {
      System.out.print(20240413L*20250411L-20250412L);
    }
}

//法二
public class Main {
    public static void main(String[] args) {
      long x = 20250412L;
      long y = 20240413L;
      long lcm = x * y / gcd(x, y);
      System.out.print(lcm - x - y);
    }
    public static long gcd(long a, long b){
      return b == 0 ? a : gcd(b, a % b);
    }
}

//法三
import java.math.BigInteger;
public class Main {
    public static void main(String[] args) {
      long ans = 20230414L;
      long gongbeishu = 1L;
      long x = 20240413L;
      long y = 20250412L;
      gongbeishu = lcm(gongbeishu, x);
      while(ans % y!= 9999L){
        ans += gongbeishu;
      }
      System.out.print(ans);
    }
    public static long lcm(long a, long b){
      long gcd = BigInteger.valueOf(a).gcd(BigInteger.valueOf(b)).longValue();// 最大公约数
      return a / gcd * b;//最小公倍数
    }
}

圆弧的数学问题【移动距离】

移动距离 20558

image

public class Main {
    public static void main(String[] args) {
      double x = 233;
      double y = 666;
      double r = Math.sqrt(x*x + y*y);
      double theta = Math.atan2(y, x);
      double ans = r + r * theta;
      System.out.print(Math.round(ans));
    }
}

这个哥们推理了为啥一次【右、弧】是最短的。
image

数学问题

客流量上限 20550

image

TODO:没看明白答案

大佬解析:
image

posted @ 2026-02-07 22:11  idle_life  阅读(4)  评论(0)    收藏  举报