F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Best Solver

Time Limit: 1500/1000 MS (Java/Others)    Memory Limit: 65535/102400 K (Java/Others)
Total Submission(s): 1524    Accepted Submission(s): 874


Problem Description
The so-called best problem solver can easily solve this problem, with his/her childhood sweetheart.

It is known that $y = (5+2\sqrt{6})^{1+2^x}$.
For a given integer $x~(0\le x<2^{32})$ and a given prime number $M~(M\le 46337)$, print $[y]\%M$. ($[y]$ means the integer part of $y$)
 

Input
An integer $T~(1<T\le 1000)$, indicating there are $T$ test cases.
Following are $T$ lines, each containing two integers $x$ and $M$, as introduced above.
 

Output
The output contains exactly $T$ lines.
Each line contains an integer representing $[y]\%M$.
 

Sample Input
7 0 46337 1 46337 3 46337 1 46337 21 46337 321 46337 4321 46337
 

Sample Output
Case #1: 97 Case #2: 969 Case #3: 16537 Case #4: 969 Case #5: 40453 Case #6: 10211 Case #7: 17947
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 12:37:50, Gzip enabled