Brute force problem and it is very easy.
My code is as follows:
#include <stdio.h>
#include <iostream>
using namespace std;
#define LEN 101
long long fib[LEN];
void init() {
fib[0] = 0;
fib[1] = 1;
for(int i = 2; i < LEN; i++) {
fib[i] = fib[i-1] + fib[i-2];
}
}
int main() {
init();
int num;
while(scanf("%d", &num) != EOF) {
int ans = num;
int i, j, k;
int flag = 0;
for(i = LEN-1; i >= 0; i--) {
if(ans >= fib[i]) {
ans -= fib[i];
for(j = i; j >= 0; j--) {
if(ans >= fib[j]) {
ans -= fib[j];
for(k = j; k >= 0; k--) {
if(ans >= fib[k]) {
ans -= fib[k];
if(0 == ans) {
// printf("%lld %lld %lld\n", fib[k], fib[j], fib[i]);
// printf("%d %d %d\n", k, j, i);
cout<< fib[k]<< " "<< fib[j]<< " "<< fib[i]<< endl;
flag = 1;
break;
}
ans += fib[k];
}
}
if(1 == flag) {
break;
}
ans += fib[j];
}
}
if(1 == flag) {
break;
}
ans += fib[i];
}
if(1 == flag) {
break;
}
}
if(-1 == i) {
printf("I'm too stupid to solve this problem\n");
}
}
return 0;
}