Sicily 1636. show me the money

来源:互联网 发布:python之父谈go 编辑:程序博客网 时间:2024/05/23 17:16
// Problem#: 1636// Author#: Reid Chan#include <iostream>using namespace std;int main() {    int t;    cin >> t;    while (t--) {        int m, n;        cin >> m >> n;        int used = 0, ai, bi;        for (int i = 0; i < n; ++i) {            cin >> ai >> bi;            used += (ai * bi);        }        int rest = m - used;        if (rest < 0) { cout << "Not enough" << endl; }        else { cout << rest << endl; }    }    return 0;}                                 

0 0
原创粉丝点击