The monkey divided the peach
Time limit:1000ms Memory limit:65536k in doubt. Dot here ^_^
Title DescriptionThe old monkey worked hard for a lifetime, leaving a huge fortune for the few monkeys--a whole bunch of peaches. The old monkey decided to give the peaches to the little monkeys.
The first monkey came, and it divided the peaches into five piles, as many as five, but one more. It left one of the rest to the old monkey and took one of the piles.
The second monkey comes, it divides the peach into five piles, five piles as many, but one more. It left an extra one for the old monkey, and took a bunch of them by himself.
Later the little monkeys did so. The last remaining peaches are all left to the old monkeys.
Here are n little monkeys, please write a program to calculate how many peaches at the beginning, and the last old monkeys can get at least a few peaches.
inputThe input includes multiple sets of test data.
Each set of test data includes an integer n (1≤n≤20).
The input ends at 0 and the line is not processed.
OutputEach set of test data corresponds to one row of output.
Includes two integers, a, B.
Represents the minimum number of peaches to start with, and the minimum number of peaches the old monkeys can get at the end.
Sample Input
5
1
0
Sample Output
3121 1025
1 1
Tips
SourceZjgsu
Sample Program
#include <stdio.h>
int main ()
{
int n,i;
Long long int sum,l,t;
while (scanf ("%d", &n)!=eof && N)
{
l=1;
for (I=1; i<n; i++)
l*=5;
sum=1+5* (L-1);
T=sum;
for (I=1; i<=n; i++)
t= (t-1)/5*4;
printf ("%lld%lld\n", sum,t+n);
}
return 0;
}