Codeforces 1011E Border (贝祖定理)

这篇博客探讨了宇航员Natasha在火星上遇到的税收问题,火星使用基于k的数字系统,并对尾数为d的税收金额感到满意。Natasha需要找出所有可能的神圣数字d。解决方案涉及计算所有面额的最大公约数g,然后列出小于k的g的倍数作为可能的d值。
摘要由CSDN通过智能技术生成

Astronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is the inhabitant of Earth, therefore she had to pay the tax to enter the territory of Mars.

There are n banknote denominations on Mars: the value of i-th banknote is ai. Natasha has an infinite number of banknotes of each denomination.

Martians have k fingers on their hands, so they use a number system with base k. In addition, the Martians consider the digit d (in the number system with base k) divine. Thus, if the last digit in Natasha's tax amount written in the number system with the base k is d, the Martians will be happy. Unfortunately, Natasha does not know the Martians' divine digit yet.

Determine for which values d Natasha can make the Martians happy.

Natasha can use only her banknotes. Martians don't give her change

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值