编程介的小学生 2017-09-27 14:25 采纳率: 0.4%
浏览 736
已采纳

Problem about GCD

Problem Description
Given integer m. Find multiplication of all 1<=a<=m such gcd(a, m)=1 (coprime with m) modulo m.

Input
Input contains multiple tests, one test per line.
Last line contains -1, it should be skipped.

[Technical Specification]
m <= 10^18

Output
For each test please output result. One case per line. Less than 160 test cases.

Sample Input
1
2
3
4
5
-1

Sample Output
0
1
2
3
4

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-15 15:50
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?