问题思考:
#include<iostream>
using namespace std;
int n, p = 0, q = 1, r = 1, dis = 1e9, MOD = 1e9 + 7, last;
int main() {
scanf("%d", &n);
while (abs(n - r) < dis) {
dis = abs(n - r);
p = q;
q = r;
last = r;
r = (p + q) % MOD;
}
cout << last;
return 0;
}