You are viewing a single comment's thread. Return to all comments →
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int tc = 0; tc < T; tc++) { int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); System.out.println(solve(a, b, c)); } sc.close(); } static String solve(int a, int b, int c) { return (c <= Math.max(a, b) && c % gcd(a, b) == 0) ? "YES" : "NO"; } static int gcd(int x, int y) { return (y == 0) ? x : gcd(y, x % y); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Die Hard 3
You are viewing a single comment's thread. Return to all comments →