您的位置:首页 > 其它

Determine whether the concatenation of a and b in this order is a square number.

2018-02-06 19:50 651 查看


Problem Statement

AtCoDeer the deer has found two positive integers, a and
b. Determine whether the concatenation of
a and
b in this order is a square number.

Constraints

1

a,b

100
a and
b are integers.

Input

Input is given from Standard Input in the following format:  a b

Output

If the concatenation of a and
b in this order is a square number, print
Yes
; otherwise, print
No
.

Sample Input :1 21

Sample Output :Yes

import java.util.Scanner;

public class Main {  

public static void main(String[] args){

    int a,b;

    int count=0;

    Scanner scan=new Scanner(System.in);

    a=scan.nextInt();

    b=scan.nextInt();

    do{

     b/=10;

     count++;

    }while(b>0);

    if(Math.sqrt((a*Math.pow(10, count))+b)%1==0){

     System.out.print("Yes");

    }

    else{

     System.out.print("No");

    }  

   } 

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐