-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path45.cpp
More file actions
43 lines (36 loc) · 646 Bytes
/
Copy path45.cpp
File metadata and controls
43 lines (36 loc) · 646 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
#include<iostream>
#include<fstream>
#include<cmath>
using namespace std;
long long int *x,*y,*z;
long long int iny(long long int f)
{
for(long long int i=0;i<100000;i++)
if(y[i]==f)
return 1;
return 0;
}
long long int inz(long long int f)
{
for(long long int i=0;i<100000;i++)
if(z[i]==f)
return 1;
return 0;
}
int main()
{x=new long long int[100000];
y=new long long int[100000];
z=new long long int[100000];
for(long long int i=0;i<100000;i++)
{
long long int a,b,c;
a=(i*(i+1))/2;
b=(i*(3*i-1))/2;
c=i*(2*i-1);
x[i]=a;y[i]=b;z[i]=c;
}
for(long long int i=0;i<100000;i++)
if(inz(x[i])&&iny(x[i]))
cout<<x[i]<<"\t"<<i<<endl;
return 0;
}