@[EDqwq](/user/294562) 草你运算符优先级看一看啊
by cyffff @ 2021-05-13 18:01:43
还是错的
by EDqwq @ 2021-05-13 18:05:29
你
`#define int long long` 了吗
by cyffff @ 2021-05-13 18:06:59
显然define了
by EDqwq @ 2021-05-13 18:07:17
你放一下完整代码吧
by cyffff @ 2021-05-13 18:08:09
```cpp
#include<bits/stdc++.h>
#define int long long
#define mem(x,y) memset(x,y,sizeof(x))
using namespace std;
int read(){
int s = 0,w = 1;
char ch = getchar();
while(ch < '0' || ch > '9'){if(ch == '-')w = -1;ch = getchar();}
while(ch >= '0' && ch <= '9')s = s * 10 + ch - '0',ch = getchar();
return s * w;
}
int num[110] = {0,2,3,5,7,11,13,17,37};
int poww(int x,int y,int mod){
int s = 1;
for(;y;y /= 2,x = (x * x * 1ll) % mod)if(y % 2 == 1)s = (s * x * 1ll) % mod;
return s % mod;
}
bool MRtest(int x,int y){
int s = x - 1,res;
while(s){
res = poww(y,s,x);
if((res ^ 1) && res + 1 != x)return false;
if(s % 2 == 1 || res + 1 == x)return true;
s /= 2;
}
return true;
}
bool isprime(int x){
if(x <= 1)return false;
if(x == 2)return true;
for(int i = 1;i <= 8;i ++){
if(x == num[i])return true;
if((x % num[i]) == 0)return false;
if(!MRtest(x,num[i]))return false;
}
return true;
}
int t;
int n;
signed main(){
scanf("%lld",&t);
while(t --){
scanf("%lld",&n);
isprime(n) ? puts("YES") : puts("NO");
}
return 0;
}
```
by EDqwq @ 2021-05-13 18:08:36
```cpp
int poww(int x,int y,int mod){
int s = 1;
for(;y;y /= 2,x = (x * x * 1ll) % mod)if(y % 2 == 1)s = (s * x * 1ll) % mod;
return s % mod;
}
```
爆 `long long` 了
by cyffff @ 2021-05-13 18:09:52
md,草
by EDqwq @ 2021-05-13 18:11:38
int128应该可以吧
by EDqwq @ 2021-05-13 18:11:49
很可以
by cyffff @ 2021-05-13 18:12:30