src2020/2864_wuxianxulie/main.cpp

49 lines
1.0 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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ÖÐÓÐ%d¸öÒ»;",now,ans);
printf("%d %d ",yi2,yi1);
printf("%d %d\n",lin2,lin1);
// printf("%dÖÐÓÐ%d¸öÒ»;",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);
}
}