ACM-ICPC 2018 焦作赛区网络预赛_J_ Participate in E-sports_

https://nanti.jisuanke.com/t/A2020

% java

package test;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static boolean judge(BigInteger a)
	{
		if(a.equals(BigInteger.ZERO))return true;
		BigInteger l = BigInteger.ONE,r = a,mid;
		while(l.compareTo(r) <= 0)
		{
			mid = l.add(r).shiftRight(1);
			BigInteger tmp = mid.multiply(mid);
			if(tmp.equals(a))
			{
				return true;
			}
			else if(tmp.compareTo(a) > 0)
			{
				r = mid.subtract(BigInteger.ONE);
			}
			else if(tmp.compareTo(a) < 0)
			{
				l = mid.add(BigInteger.ONE);
			}
		}
		return false;
	}
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n;
		n = scanner.nextInt();
		for(int i = 1; i <= n; i ++)
		{
			
			BigInteger two = BigInteger.valueOf(2);
			BigInteger a;
			a = scanner.nextBigInteger();
			BigInteger en = a.multiply(a.subtract(BigInteger.ONE)).divide(two);
			
			boolean b1 = judge(a),e1 = judge(en);
			
			if(b1 && e1)
			{
				System.out.println("Arena of Valor");
			}
			else if(b1 && !e1){
				System.out.println("Hearth Stone");
			}
			else if(!b1 && e1){
				System.out.println("Clash Royale");
			}
			else{
				System.out.println("League of Legends");

			}
		}
	}

}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值