Sicily 1636. Show me the money
来源:互联网 发布:武汉理工大学网络教学 编辑:程序博客网 时间:2024/06/05 02:37
Time Limit: 1 secs, Memory Limit: 32 MB
Description
Fakosh like playing the game “StarCraft”. However, he is not so good at this game that he can’t beat the AI. For victory, he typed “show me the money” to cheat, and then he would get some money in the game. Now he can build more powerful cannons and make more strong soldiers with the money. But maybe the money is not enough, so he wants to know the amount of the money left.
Input
The first line of the input is an integer T, the number of test cases.
In each test case, the first line is the money M(1<=M<=1000) that Fakosh would get after he typed “show me the money”, and N(1<=N<=5), the number of kinds of the cannons or soldiers he would like to make. Each of the next N lines will contain two integers Ai(1<=Ai<=100) and Bi(1<=Bi<=5). Ai is the price of the cannon or soldier, Bi is the number of the cannon or soldier of this kind he would like to make.
Output
For each test case, if the money is not enough, output “Not enough”, or else output the amount of the money left, in one line.
Sample Input
3
10 2
5 1
3 1
100 2
25 2
50 1
8 1
3 3
Sample Output
2
0
Not enough
(^o^)/ Just do it!
#include <iostream>using namespace std;int main(){ int money, test, num1, num2; int T; cin >> T; while (T--) { cin >> money >> test; while (test--) { cin >> num1 >> num2; money -= num1 * num2; } if (money < 0) cout << "Not enough" << endl; else cout << money << endl; } return 0;}
- sicily--1636. show me the money
- Sicily 1636. show me the money
- [sicily]1636. show me the money
- Sicily 1636. Show me the money
- 1636. show me the money
- 1636. show me the money
- Show me the money
- Show Me the Money
- Sicily 2371. Show Me The Fax
- 【职场】帮你.帮我和Show. Me. The. Money.
- 【职场】帮你.帮我和Show. Me. The. Money.
- 【职场】帮你.帮我和Show. Me. The. Money.
- 【职场】帮你.帮我和Show. Me. The. Money.
- 【职场】帮你.帮我和Show. Me. The. Money.
- 【职场】帮你.帮我和Show. Me. The. Money.
- Show me the Template
- Show me the Template
- Show me the truth -- 告诉我真相
- linux目录详细
- 系统架构设计理论与原则、负载均衡及高可用系统设计速记
- DEP: Ret2Libc via VirtualProtect()
- Android自动化-双击操作
- Python系列之 - python文件操作
- Sicily 1636. Show me the money
- shell处理文件
- Oracle数字型,字符型,日期型函数
- windows配置php时显示Loaded Configuration File:None
- rabbitMq学习笔记(未完)
- Android studio中常用插件
- 批量插入
- linux下文件名的操作
- 枚举enum专题