题解 | #[NOIP2015]金币#
[NOIP2015]金币
http://www.nowcoder.com/practice/8f71f5670e6a45118d24d13868a2da9e
#include <stdio.h>
int main() {
int num = 0;
int day = 0;
int count = 1;
int sum = 0;
scanf("%d", &day);
for (int i = 0; i < day; i++, num++) {
if (num == count) {
num = 0;
count++;
}
sum += count;
}
printf("%d", sum);
return 0;
}