- #include <bits/stdc++.h>
- using namespace std;
- int a[50];
- bool b[48];
- int main()
- {
- a[0] = 1;
- a[1] = 1;
- for(int i = 2; i <= 45; i++){
- a[i] = a[i-1] + a[i-2];
- //cout<<a[i]<<" ";
- }
- int cs , t;
- cin>>t;
- for ( cs = 1 ; cs <= t ; cs++ ){
- int n, index = -1;
- cin>>n;
- for(int i = 45; i>=1; i--){
- if(a[i]<=n){
- if(index == -1){
- index = i;
- }
- n = n - a[i];
- b[i] = true;
- }
- }
- printf("Case %d: ",cs);
- for(int i = index; i >=1; i--){
- if(b[i]){cout<<"1";}
- else cout<<"0";
- }
- cout<<endl;
- memset(b, false, sizeof(b));
- }
- return 0;
- }
Thursday, 27 July 2017
Lightoj 1105 - Fi Binary Number
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
-
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
No comments:
Post a Comment