mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
26a72e347d
2100-2199
31 lines
744 B
C++
31 lines
744 B
C++
#include<stdio.h>
|
|
#include<math.h>
|
|
int main()
|
|
{
|
|
int n,m,j,k;
|
|
double i;
|
|
while(scanf("%d%d",&n,&m)&&n&&m)
|
|
{
|
|
k=m-n;i=(1+sqrt(5))/2;
|
|
j=k*i;
|
|
if(n==j)
|
|
printf( "0\n" );
|
|
else
|
|
{
|
|
printf( "1\n" );
|
|
if(n>j)
|
|
printf("%d %d\n",j,j+k );
|
|
for(k=0;k*i<=n;k++)
|
|
if(int(k*i)==n-k)
|
|
printf("%d %d\n",n-k,n);
|
|
for(k=0;k*i<=m;k++)
|
|
if((int(k*i+k)==m)&&(m-k<n))
|
|
printf("%d %d\n",m-k,m);
|
|
for(k=0;k*i<=n+1;k++)
|
|
if((int(k*i)==n)&&(n+k<m))
|
|
printf("%d %d\n",n,n+k);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|