Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
太失败了,这么简单的题居然交了13次才通过。个人思路: 设输入的是abcd,假设其解是n进制,则有 (a*n*n*n + b*n*n + c*n + d)%(n-1)=0 则有:( (a*n*n*n)%(n-1)+ (b*n*n)%(n-1)+ (c*n)%(n-1)+ d )%(n-1)=0 则有:( (a* (n%(n-1)) *(n%(n-1)) *(n%(n-1)))+ (b* (n%(n-1)) *(n%(n-1)))+ (c* (n%(n-1) + d ) %(n-1)=0 则有: (a*1*1*1+b*1*1+c*1+d)%(n-1)=0 则有:(a+b+c+d)%(n-1)=0 所以,经过转换,变为求输入数的各数位的和能%(n-1)等于0; Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator