Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<string>
- using namespace std;
- int main(){
- ifstream read;
- ofstream write;
- read.open("input.txt");
- write.open("output.txt");
- int N,pos;
- for(int i=0;i<3;i++){
- read>>N;
- int A[N];
- int B[N]={0};
- A[0]=1;
- A[1]=2;
- for(int j=2;j<N;j++){
- A[j]=A[j-1]+A[j-2];
- if(A[j]>=N){
- pos=j;
- break;
- }
- }
- for(int j=pos;N!=0;j--)
- if(A[j]<=N){
- N-=A[j];
- B[j]=1;
- }
- for(int j=0;j<pos;j++) write<<B[j];
- write<<endl;
- }
- read.close();
- write.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement