-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path104.cpp
More file actions
44 lines (42 loc) · 832 Bytes
/
Copy path104.cpp
File metadata and controls
44 lines (42 loc) · 832 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
#include"bigint.h"
#include<fstream>
#include<cmath>
using namespace std;
bool ispan(BigInt b,int c)
{cout<<c<<endl;
int a[]={0,0,0,0,0,0,0,0,0,0};
for(int i=0;i<9;i++)
{//cout<<(b[i]-'0')<<"\t"<<(b[b.noOfDigits()-i-1]-'0')<<endl;
//a[b[i]-'0']++;
a[b[b.noOfDigits()-i-1]-'0']++;
}
for(int i=1;i<=9;i++)
{//cout<<a[i]<<"\t";
if(a[i]!=1)
return false;
}
int x[]={0,0,0,0,0,0,0,0,0,0};
for(int i=0;i<9;i++)
{//cout<<(b[i]-'0')<<"\t"<<(b[b.noOfDigits()-i-1]-'0')<<endl;
x[b[i]-'0']++;
//a[b[b.noOfDigits()-i-1]-'0']++;
}
for(int i=1;i<=9;i++)
{//cout<<a[i]<<"\t";
if(x[i]!=1)
return false;
}
cout<<b<<endl<<c<<endl;
return true;
}
int main()
{int k=3;
//cout<<ispan(BigInt("53624187921649849845963245187"),5);
for(BigInt i='1',j='2';!ispan(j,k);k++)
{
BigInt tmp=i;
i=j;
j=j+tmp;
}
return 0;
}