CodeFoeces-439B

题目

原题链接:B. Devu, the Dumb Guy

题意

有n门课程,每门课程有ni个章节,每个章节学习需要x小时,每学完一个课程x--(x>=1),问学完所有课程最少需要多少时间。

代码

#include
using namespace std;
int main() {
    int n,x,s[100000];
    scanf("%d%d",&n,&x);
    for(int i=0; i1){
            x--;
        }
    }
    printf("%I64d\n",ans);
    return 0;
}

你可能感兴趣的:(CodeFoeces-439B)