分析:分析当整除(a+b)的时候肯定是后者胜利,如果余数不等于0的时候,如果余数大于b肯定是前者胜利,否则后者胜利。
代码:
import java.math.*; import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner cin = new Scanner(System.in); BigInteger n, a, b; while(cin.hasNext()){ n = cin.nextBigInteger(); a = cin.nextBigInteger(); b = cin.nextBigInteger(); a = a.add(b); n = n.mod(a); //System.out.println(n); if(n.compareTo(BigInteger.ZERO) == 0) System.out.println("Yougth"); else if(n.compareTo(b) > 0){ System.out.println("Yougth"); } else System.out.println("Hrdv"); } } }
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=1077
时间: 2024-10-22 01:29:32