//简单的数学题!
#include "iostream"
using namespace std;
int main()
{
int days, i, ans, sum;
while (cin >> days && days)
{
sum = 0;
ans = 0;
for (i = 1; ; i++)
{
sum += i;
if (sum <= days)
ans += i * i;
else break;
}
ans += ( days - (sum-i) ) * i;
cout << days << " " << ans << endl;
}
system("pause");
}
poj 2000 Gold Coins
最新推荐文章于 2017-04-05 18:49:10 发布