ICPC--1290: 2^x mod n = 1
1290: 2^x mod n = 1题目描述Give a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1.
输入One positive integer on each line, the value of n.
输出If the minimum x exists, print a line with 2^x mod n = 1.
【ICPC--1290: 2^x mod n = 1】Print 2^? mod n = 1 otherwise.
You should replace x and n with specific numbers.
样例输入25
样例输出2^? mod 2 = 12^4 mod 5 = 1
代码#include #include using namespace std; int main(){int n,i,x;while(~scanf("%d",else{for(i=1,x=2;; i++,x*=2){if(x%n==1) break;x%=n;}printf("2^%d mod %d = 1\n",i,n);}}return 0;}
- 特斯拉 Model 3上市,外观小改,性能提高,续航里程更长
- 特斯拉高管:国产ModelY明年开售,将向其他品牌开放充电桩
- 刚刚!电池巨无霸成立,拿下国产特斯拉Model Y订单,A股小伙伴来了
- 数读|Model 3跌出欧洲畅销榜前十,谁把特斯拉踢下王位?
- 车型|特斯拉Model Y、ARCFOX S进入新一批新能源汽车推荐车型目录
- 屌丝车型出王者!宏光MINI超Model3成最畅销的新能源车
- 特斯拉model 3改色超亚紫,还看得出从前豪华车的样子
- 马斯克赢了!特斯拉“内鬼”将赔偿公司40万美元:非法泄露Model 3车型生产商业秘密
- Ark Invest:特斯拉(TSLA.US)Model 3能效高出竞争对手2倍
- 谁能挑战特斯拉Model3?宏光MINIEV自信点了点头