Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

太失败了,这么简单的题居然交了13次才通过。

Posted by link85 at 2007-05-29 00:30:16 on Problem 1152
个人思路:
  设输入的是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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator