Migrated from Lutece 1717 京电的神秘矩阵
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
京电的主楼里发现一个m*n的矩阵。
该矩阵的第一列是ab,(a+1)b,......,(a+n−1)b
第二列是ab+1,(a+1)b+1,......,(a+n−1)b+1
.......
第m列是ab+m−1,(a+1)b+m−1,.....(a+n−1)b+m−1
下面是一个4*4的矩阵:
22=4,23=8,24=16,25=32
32=9,33=27,34=81,35=243
42=16,43=64,44=256,45=1024
52=25,53=125,54=625,55=3125
问这个矩阵里有多少不重复的数(比如24=42,这样的话就有重复了)
在出题的时候听到一首歌:全部都是你 推荐
输入数据包括4个数:m,n,a,b。(2≤m,n,a,b≤100)。
Output
输出一个整数表示答案
Samples
4 4 2 2
15
Resources
2017 UESTC Training for Math