lalala ~~ (I will not tell you this is the problem face it)
This question is indeed a pit, the first pass exhaustive timeout, and then began the long road to find the law. . .
Finally, after five minutes of tangled, I finally discovered the magic of the law, that is,
Fabonacci !!!
Well, this is not the value of excitement. . .
Detailed explanation look at the code:
1 #include<set> 2 #include<map> 3 #include<list> 4 #include<queue> 5 #include<stack> 6 #include<string> 7 #include<cmath> 8 #include<ctime> 9 #include<vector> 10 #include<bitset> 11 #include<memory> 12 #include<utility> 13 #include<cstdio> 14 #include<sstream> 15 #include<iostream>//其实本题只需要这一个头文件。。。 16 #include<cstdlib> 17#include <CString> 18 #include <algorithm> // personal advice to the header file will have to write up, so as not to call the library command does not appear 19 a using namespace std; 20 Long Long k, A, b, c; / / lovely four functions ~~~ 21 is int main () { // cute main ~~~ 22 is CIN >> K; // cute input ~~~ 23 is a = B = . 1 ; 24 C = a + B; // cute initial value ~~~ 25 the while (C <= K) { // cute cycle ~~~ 26 is a = B; 27 B = C; 28 A = B + C; // with three cycle simulation data array, space-saving role played 29 } 30 COUT << " m = " << A << endl; 31 is COUT << " n-= " << B endl <<; // cute output ~~~ 32 return 0 ; 33 is }
Finally, I wish you all success programming ~~~
Bo opened new, encouragement friends ~ ~ ~