当前位置: 代码迷 >> 综合 >> HDOJ 1562 Guess the number
  详细解决方案

HDOJ 1562 Guess the number

热度:40   发布时间:2023-10-21 19:13:40.0

HDACM 1562

水题…

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int n = sc.nextInt();while (n-->0) {int a = sc.nextInt();int b = sc.nextInt();int c = sc.nextInt();int i = (1000/a+1)*a;for (; i < 10000; i+=a) {if ((i+1)%b==0 && (i+2)%c==0) {System.out.println(i);break;}}if (i>=10000) {System.out.println("Impossible");}}sc.close();}
}
  相关解决方案