Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
108365 Block Xuan 混合牛奶 C++ 通过 100 2 MS 296 KB 1286 2023-11-02 13:39:02

Tests(8/8):


//I am Block Xuan #include<algorithm> //I am Block Xuan #include<iostream> //I am Block Xuan using namespace std; //I am Block Xuan struct P{ int v,w; bool operator < (const P &q) const{ return v < q.v; } }s[5005]; //I am Block Xuan int main(){ //I am Block Xuan long long n,m,money = 0,o = 0; //I am Block Xuan cin>>n>>m; //I am Block Xuan for (int i = 0;i < m;i++){ //I am Block Xuan cin>>s[i].v>>s[i].w; //I am Block Xuan } //I am Block Xuan if (n == 0 && m == 0){ //I am Block Xuan cout<<0<<endl; //I am Block Xuan return 0; //I am Block Xuan } //I am Block Xuan sort(s,s + m); //I am Block Xuan for (int i = 0;i < m;i++){ //I am Block Xuan for (int j = 1;j <= s[i].w;j++){ //I am Block Xuan money += s[i].v; //I am Block Xuan n--; //I am Block Xuan if (n <= 0){ //I am Block Xuan cout<<money<<endl; //I am Block Xuan return 0; //I am Block Xuan } //I am Block Xuan } //I am Block Xuan } //I am Block Xuan cout<<money<<endl; //I am Block Xuan return 0; //I am Block Xuan } //I am Block Xuan


测评信息: