Determine whether the concatenation of a and b in this order is a square number.
2018-02-06 19:50
651 查看
b. Determine whether the concatenation of
a and
b in this order is a square number.
≤
a,b
≤
100
a and
b are integers.
b in this order is a square number, print
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");
}
}
}
Problem Statement
AtCoDeer the deer has found two positive integers, a andb. 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 bOutput
If the concatenation of a andb 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");
}
}
}
相关文章推荐
- matlab:Warning: Unable to determine the number of frames in this file.
- IAR中出现the order of volatile accesses is undefined in this statement的解决办法
- This function has none of Deterministic,no sql,or reads sql data in its declaration and binary logging is enabled(you *might* want to use the less safe log_bin_trust_function_creators variable
- Determine whether the product of a and b is even or odd.
- undefined behavior: the order of volatile accesses is undefined in this statement
- Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
- Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
- Given an array of size N in which every number is between 1 and N, determine if there are any dupli
- IAR编译 Warning[Pa082]:undefined behavior: the order of volatile accesses is undefined in this stateme
- Warning: Unable to determine the number of frames in this file
- A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Gi
- Odd elements at odd and even elements at even positionThis is question asked in one of the interview
- Warning[Pa082]:undefined behavior: the order of volatile accesses is undefined in this statement
- Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
- This version of the rendering library is more recent than your version of ADT plug-in. Please update
- Given preorder and inorder traversal of a tree, construct the binary tree.
- This version of the rendering library is more recent than your version of ADT plug-in. Please updat
- This generally means that another instance of this process was already running or is hung in the deb
- This version of the rendering library is more recent than your version of ADT plug-in. Please update
- eclipse创建android项目,无法正常预览布局文件,出现This version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in...