璟雯院

珺璟如晔,雯华若锦

用户工具

站点工具


icpc:problems:luogup2669
problems
名称金币
题目编号NOIP 2015 PJ T1
题目链接luogu.com.cn/…
来源CCF
算法分类数学, 入门_循环
难易程度容易

金币

想法

按天进行模拟。

代码实现

#include<cstdio>
 
int main() {
    int n, sum = 0, cnt = 1;
    scanf("%d", &n);
    for(int i=1; i<=n; ) {
        for(int j=1; j<=cnt&&i<=n; j++, i++)
            sum += cnt;
        cnt++;
    }
    printf("%d", sum);
    return 0;
}
/app/www/public/data/pages/icpc/problems/luogup2669.txt · 最后更改: 2024/05/05 14:37 由 温婕莺