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

建议使用的浏览器:

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

2102:Incredible! Impossible!

题目描述
"Give me the sums of each column and of each row of the rectangular table n*m", --- Alex said, --- "and I will tell you whether such a table exists, and if exists for a small fee I can create an example of such table". "Incredible! Impossible!", --- say all his classmates, --- "So many numbers! You must be a true genius!".
But Basil does not like that Alex becomes the most known person at the school.
--- "I say! I am Basil the greatest! Given a rectangular table n*m and the sums of rows and columns I will tell you a number of possible tables with non-negative integers satisfying these conditions".
--- "You boast! I bet five dollars you can't do it even for n*3", --- Alex says.
--- "I bet five that I can!", --- says Basil.
Tomorrow is the contest. Alex will create some tables with size n*3, and tell Basil the sums and the dimensions. All boys and girls do the stakes who will be the winner!
You are the friend of Alex. He wants to create some hard data sets for Basil, and he needs to have a method to calculate the answer. Because Alex can't solve such kind of tasks, he asked you to write a program that will do it for him.
Alex needs only last seventeen digits to check the answers. So you must calculate the number of possible tables taken modulo 1017 .
输入解释
The first line contains four numbers: n, c1 , c2 , c3 , where n is the number of rows, ci are the sums of columns. n numbers follow, each is the sum of the corresponding row. n and all sums are non-negative integers. They are not greater than 125.
输出解释
On the first line output the number of possible tables taken modulo 1017 .
输入样例
3 1 2 3
2 3 4
输出样例
0
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 2000MS

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2102

最后修改于 2020-10-29T06:23:27+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
20000 64000