-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path33.cpp
More file actions
62 lines (62 loc) · 796 Bytes
/
Copy path33.cpp
File metadata and controls
62 lines (62 loc) · 796 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include<iostream>
#include<fstream>
using namespace std;
void cancel(int a,int b)
{//cout<<a<<"\t"<<b<<endl;
int a1,a2,b1,b2;
a1=a/10;
a2=a%10;
b1=b/10;
b2=b%10;
//cout<<(a2==b1)<<"\t"<<(b2/((1.0*a1))<<"\t";
if(a1==b1&&a2!=0)
{
if(b2/(1.0*a2)==b/(1.0*a))
{
cout<<a<<"\t"<<b<<endl;
}
}
if(a1==b2&&a2!=0)
{
if(b1/(1.0*a2)==b/(1.0*a))
{
cout<<a<<"\t"<<b<<endl;
}
}
if(a2==b1&&a1!=0)
{
if(b2/(1.0*a1)==b/(1.0*a))
{
cout<<a<<"\t"<<b<<endl;
}
}
if(a2==b2&&a1!=0)
{
if(b1/(1.0*a1)==b/(1.0*a))
{
cout<<a<<"\t"<<b<<endl;
}
}
}
int gcd(int a, int b) {
int r, i;
while(b!=0){
r = a % b;
a = b;
b = r;
}
return a;
}
int main()
{
for(int i=11;i<100;i++)
{
for(int j=i+1;j<100;j++)
{//cout<<i<<"\t"<<j<<"\t"<<gcd(i,j)<<endl;
if(gcd(i,j)!=1)
cancel(i,j);
}
}
//cancel(49,98);
return 0;
}