#1499. 小猪存钱罐
小猪存钱罐
题目描述
小青遇到了这样一个问题:Before ACM can do anything, a budget must be prepared and the necessary financial support obtained.
输入格式
The input consists of T test cases. Each test case begins with two integers E and F. On the second line, there is an integer N. Following this are N lines, each specifying a coin type with two integers P and W.
输出格式
Print exactly one line of output for each test case. The line must contain The minimum amount of money in the piggy-bank is X. where X is the minimum amount of money. If the weight cannot be reached exactly, print This is impossible.
样例
样例 1
输入 # 1
2
1 4
3
5 4
5 5
4 4
输出 # 1
The minimum amount of money in the piggy-bank is 6.