# Gold Coins

### From Progteam

Sorter: | mlc413 |
---|---|

Source: | Unknown |

Link: | http://acm.pku.edu.cn/JudgeOnline/problem?id=2000 |

**Gold Coins** is problem number 2000 on the Peking University ACM
site.

import java.util.*; public class Main{ public static Scanner in; public static void main(String[] args){ in=new Scanner(System.in); doStuff(); } public static void doStuff(){ int N=in.nextInt(); while(N!=0){ solve(N); N = in.nextInt(); } } public static void solve(int N){ int total = 0; int N_ = N; int days = 1; while(N>0){ total += days*days; N-=days; days++; } if(N < 0){ total -= -1*(N)*(days-1); } System.out.println(N_ + " " + total); } }