沙漠储油点
Sample Input
1000 1100 0
Sample Output
1 25 3500 2 63 3000 3 108 2500 4 163 2000 5 234 1500 6 334 1000 7 500 500 1 14 5500 2 37 5000 3 63 4500 4 92 4000 5 125 3500 6 163 3000 7 208 2500 8 263 2000 9 334 1500 10 434 1000 11 600 500
#include<stdio.h>
void main()
{
int dis,k,oil,n,i;
scanf("%d",&n);
while(n)
{
int a[2][65]={0};
dis=500,k=1,oil=500;
do
{
a[0][k]=n-dis,a[1][k]=oil;
k++;
dis=dis+500/(2*k-1);
oil=500*k;
}while(dis<n);
for(i=1;i<k;i++)
printf("%d %d %d\n",i,a[0][k-i],a[1][k-i]);
scanf("%d",&n);
}
}