#include <stdio.h> int main() { int n = 0; scanf("%d", &n);//输入天数 int a = 0;//带值所用 int length = 0;//计算天数 int total = 0;//计算金币总数 while (n > length) { int i = 1000;//定义一个数字用于循环 for (a = 1; a <= i; a++) { int j = 1; for (j = 1; j <= a; j++) { total += a; length++; if (length == n) { break; } } if (length == n) { break; } } } printf("%d\n", total); return 0; }