题解 | #[NOIP2015]金币#
[NOIP2015]金币
http://www.nowcoder.com/practice/8f71f5670e6a45118d24d13868a2da9e
int main()
{
int a, b, c;
int sum = 0;
int d = 0;
scanf("%d", &a);
for (b = 1; d < a; b++)
{
for (c = 0; c < b; c++)
{
sum += b;
d++;
if (d == a)
{
break;
}
}
}
printf("%d\n", sum);
return 0;
}