题解 | #BC96 [NOIP2015]金币#
[NOIP2015]金币
https://www.nowcoder.com/practice/8f71f5670e6a45118d24d13868a2da9e
#include <stdio.h> int main() { int k, s = 0; scanf("%d", &k); int step = 1, step_count = 0; for (int i = 1; i <= k; i++) { if (step_count < step) { s += step; step_count++; } if (step_count == step) { step++; step_count = 0; } } printf("%d\n", s); return 0; }