#include <iostream> #include <stdio.h> using namespace std; /**************************************************************************************************************** 题意: 大致就是求 费波纳茨数列各项值以及求和 思路: 1,思路不难,但是容易超时 2,别每次都去求数列,刚开始的时候打表即可 3,谢谢白猫儿,自己 TL 了半天,还是她说的 ****************************************************************************************************************/ long long f[105],sum[105]; int main() { long long N; while(cin>>N) { f[0]=0; f[1]=1; sum[1]=1; if(N==3) cout<<1<<" "<<1<<endl; else{ for(int i = 2;i < 100;i ++){ f[i]=f[i-1]+f[i-2]; sum[i]=sum[i-1]+f[i]; if(N <= sum[i]){ if(N - sum[i-1] <= f[i-1]) cout<<i-1<<" "<<f[i-1]<<endl; else cout<<i<<" "<<N-sum[i-1]<<endl; break; } } } } return 0; }