Processing math: 100%
祝同学们学习进步,编程快乐!
Problem 2991 --Fansblog

2991: Fansblog

"
Time Limit 2 秒/Second(s) Memory Limit 512 兆字节/Megabyte(s)
提交总数 0 正确数量 0
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
Farmer John keeps a website called ‘FansBlog’ .Everyday , there are many people visited this blog.One day, he find the visits has reached P , which is a prime number.He thinks it is a interesting fact.And he remembers that the visits had reached another prime number.He try to find out the largest prime number Q ( Q < P ) ,and get the answer of Q! Module P.But he is too busy to find out the answer. So he ask you for help. ( Q! is the product of all positive integers less than or equal to n: n! = n * (n-1) * (n-2) * (n-3) *… * 3 * 2 * 1 . For example, 4! = 4 * 3 * 2 * 1 = 24 ) 
First line contains an number T(1<=T<=10) indicating the number of testcases. 
Then T line follows, each contains a positive prime number P (1e9≤p≤1e14) 
For each testcase, output an integer representing the factorial of Q modulo P. 
1
1000000007
328400734

推荐代码 查看2991 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[ ms]
内存最少[ KB]
第一AC
第一挑战

赛题来源/所属竞赛 2019 Multi-University Training Contest 3 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛
AOJ
祝同学们学习进步,编程快乐!