社区讨论
关于在线性筛中使用__int128
学术版参与者 7已保存回复 14
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 12 条
- 当前快照
- 1 份
- 快照标识符
- @m0xj9bre
- 此快照首次捕获于
- 2024/09/11 15:22 去年
- 此快照最后确认于
- 2025/11/05 00:21 4 个月前
CPP
#include<bits/stdc++.h>
#define int __int128
typedef long long ll;
typedef unsigned long long ull;
inline int read(){char ch=getchar();int x=0,f=1;for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<3)+(x<<1)+(ch^48);return x*f;}
int vis[1000],p[1000],tot;
signed main(){
freopen("in.in","r",stdin);freopen("out.out","w",stdout);
std::ios::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0);
int n=10;
for(int i=2;i<=n;++i){
if(!vis[i])p[++tot]=i;
for(int j=1;p[j]*i<=n;++j){
int x=p[j]*i;
vis[x]=1;
if(i%p[j]==0)break;
}
}
}
这份代码会在
if(i%p[j]==0) 语句 RE,关了 __int128 就没事,求教教。回复
共 14 条回复,欢迎继续交流。
正在加载回复...