# POJ 2000 Gold Coins（水~）

Description

1金币 1
2金币 2 3
3金币 4 5 6
4金币 7 8 9 1 0
5金币 11 12 13 14 15
…………………………………………
Input

Output

Sample Input
10
6
7
11
15
16
100
10000
1000
21
22
0
Sample Output
10 30
6 14
7 18
11 35
15 55
16 61
100 945
10000 942820
1000 29820
21 91
22 98
Solution

Code

#include<stdio.h>
int main()
{
int i,j,n,m,day;
while(scanf("%d",&n)&&n)
{
m=day=0;
for(i=1;;i++)
{
if(day+i<n)
{
m+=i*i;
day+=i;
}
else
break;
}
m+=i*(n-day);
printf("%d %d\n",n,m);
}
}

#### POJ 2000 Gold Coins

2015-09-13 19:20:10

#### [ACM] POJ 2000 Gold Coins

2014-07-12 17:13:30

#### 【水】POJ 2000——Gold Coins

2013-09-23 19:30:20

#### Gold Coins(闲来无事水一发)

2014-09-27 11:47:58

#### Baskets of Gold Coins 2401

2014-04-19 13:46:44

#### Bytelandian gold coins

2014-01-12 22:10:16

#### HDOJ(HDU) 2401 Baskets of Gold Coins(数列、)

2016-05-08 17:17:50

#### POJ-2000 Gold Coins

2015-08-07 20:00:02

#### HDU2401 Baskets of Gold Coins【水题】【推理】

2015-01-31 13:35:55

#### zoj 3008 Gold Coins

2015-11-24 10:58:29