-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB1091.cpp
More file actions
38 lines (36 loc) · 713 Bytes
/
B1091.cpp
File metadata and controls
38 lines (36 loc) · 713 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
29
30
31
32
33
34
35
36
37
38
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
int k;
cin>>k;
int temp;
temp = k*k;
for(int j=1;j<10;j++)
{
int temp0,l=10,flag=0;
temp0 = temp*j;
while(1)
{
if(k==temp0%l)
{
cout<<j<<" "<<temp0<<endl;
flag=1;
break;
}
l*=10;
if(k<temp%l)
break;
}
if(flag==1)
break;
if(j==9)
cout<<"no"<<endl;
}
}
return 0;
}