zoj 3609 Modular Inverse

zoj 3609 Modular Inverse,第1张

zoj 3609 Modular Inverse
#include<cstdio>#include<cstring>#include<iostream>using namespace std;int a,m,cas;bool vis[1111];int main(){ cin>>cas; while (cas--) { cin>>a>>m; int i=1; memset(vis,0,sizeof(vis)); while (1) { int t=(a*i) % m; if (t==1 % m) { printf("%dn",i); break; } if (!vis[t]) vis[t]=1; else { printf("Not Existn"); break; } i++; } }}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4922010.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-12
下一篇 2022-11-12

发表评论

登录后才能评论

评论列表(0条)

保存