题解 | #[NOIP2015]金币#
[NOIP2015]金币
http://www.nowcoder.com/practice/8f71f5670e6a45118d24d13868a2da9e
#include <stdio.h>
int main()
{
int k;
scanf("%d", &k);
int jin = 0;
for (int n = 1; n <=k ; n++)
{
int he = 0;
int i;
for (i = 1; ; i++)
{
he += i;
if (he >= n)
{
break;
}
}//判断第n天该发多少金币
jin += i;
}
printf("%d", jin);
return 0;
}