-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI091.java
More file actions
28 lines (26 loc) · 947 Bytes
/
I091.java
File metadata and controls
28 lines (26 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package levelB;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class I091 {
public static void main(String[] args) throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int M=Integer.parseInt(br.readLine());
String[] str=br.readLine().split(" ");
br.close();
for(int i=0;i<M;i++){
int K=Integer.parseInt(str[i]);
boolean flag=true;
for(int N=1;N<10;N++){
String temp=String.valueOf(N*K*K);
int value=Integer.parseInt(temp.substring(temp.length()-String.valueOf(K).length(),temp.length()));
if(value==K){
System.out.println(N+" "+temp);
flag=false;
break;
}
}
if(flag)
System.out.println("No");
}
}
}