当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5049:Guess the Money

题目描述
Dshawn is a tuhao. He has a lot of money. One day, he gave A dollars to kuangbin and cxlove. kuangbin got B dollars and cxlove got C dollars. Obviously, A = B + C.

wuyiqi is very curious, he want to know the A,B and C. But they didn’t tell him. Just tell him some information about the three numbers.

Dshawn said that the number A has N1 digits in its decimal representation (without extra leading zero). Assume the digits of its decimal expansion from the left to the right are a0, a1, ..., aN1 - 1. Dshawn didn’t tell wuyiqi all the digits but tell him M1 digits.

kuangbin said that the number B has N2 digits in its decimal representation (without extra leading zero). Assume the digits of its decimal expansion from the left to the right are b0, b1, ..., bN2 - 1. kuangbin didn’t tell wuyiqi all the digits but tell him M2 digits.

cxlove said that the number C has N3 digits in its decimal representation (without extra leading zero). Assume the digits of its decimal expansion from the left to the right are c0, c1, ..., cN3 - 1. cxlove didn’t tell wuyiqi all the digits but tell him M3 digits.

You should find the number of possible {A, B, C}. It is possible that someone tells lies, so if the information given is inconsistent with any possible {A, B, C}, you should also detect this.
输入解释
The first line of the input is T (1 ≤ T ≤ 50), which stands for the number of test cases you need to solve.

The first line of each case contains two integers N1,M1 (1 ≤ N1 ≤ 107, 0 ≤ M1 ≤ min(N1, 104)).

For the next M1 lines, each line contains two integers id and x (0 ≤ id < N1, 0 ≤ x ≤ 9) means aid = x.

The next line contains two integers N2,M2 (1 ≤ N2 ≤ 107, 0 ≤ M2 ≤ min(N2, 104)).

For the next M2 lines, each line contains two integers id and x (0 ≤ id < N2, 0 ≤ x ≤ 9) means bid = x.

The next line contains two integers N3,M3 (1 ≤ N3 ≤ 107, 0 ≤ M3 ≤ min(N3, 104)).

For the next M3 lines, each line contains two integers id and x (0 ≤ id < N3, 0 ≤ x ≤ 9) means cid = x.
输出解释
For each test case, print a line “Case #t: ”(without quotes, t means the index of the test case) at the beginning.

If it is impossible, please output “IMPOSSIBLE” else output the answer modulo 20140927.
输入样例
3	
2 0
1 1
0 9
1 0
1 1
0 5
1 0
1 0
2 0
3 0
2 0
输出样例
Case #1: 9
Case #2: 6
Case #3: IMPOSSIBLE
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5049

最后修改于 2020-10-25T23:19:16+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)