src2020/2864_wuxianxulie/main.cpp

49 lines
1.0 KiB
C++
Raw Permalink Normal View History

2020-05-03 18:35:08 +08:00
#include <iostream>
#include<cstdio>
using namespace std;
long long dg(long long n)
{
cout<<n<<":";
if(n<=2){
return 1;
}
if(n==3){
return 2;
}
long long yi1 = 1, yi2 = 1;
long long lin1 = 1, lin2 = 0;
long long ans = 1, now = 2;
while(now<n){
printf("%d<><64><EFBFBD><EFBFBD>%d<><64>һ;",now,ans);
printf("%d %d ",yi2,yi1);
printf("%d %d\n",lin2,lin1);
// printf("%d<><64><EFBFBD><EFBFBD>%d<><64>һ;",now,ans);
// printf("%d %d ",yi2,yi1);
// printf("%d %d ",lin2,lin1);
long long u=yi1+yi2;
yi2=yi1;
yi1=u;
long long u0=lin1+lin2;
lin2=lin1;
lin1=u0;
ans+=yi1;
now+=yi1+lin1;
if(now==n){
return ans;
}
if(now>n){
return ans-yi1+dg(n-(now-yi1-lin1));
}
}
}
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
long long yi, er;
cin >> yi >> er;
cout <<endl<< dg(er) - dg(yi-1);
}
}