Files
python/TangDou/LuoGuBook/P2669.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

20 lines
583 B
C++

#include <bits/stdc++.h>
using namespace std;
int k; //第k天付出多少个金币
int coin; //多少个金币
int day = 1; //现在是第几天
int main() {
cin >> k;
for (int i = 1;; i++) { //此层循环描述的是第几轮
for (int j = 1; j <= i; j++) { //此层循环描述是当前轮的第几天
//金币数增加p个(轮次号个)
coin += i;
if (day == k) {
cout << coin << endl;
return 0;
}
day++;
}
}
}