yanghaoyu123 @ 2024-11-12 22:31:53
#include <iostream>
using namespace std;
long long cc[100000005];
int main()
{
int n,q,c=0;
cin>>q>>n;
cc[1]=1;
int arr[n];
int ss=0;
int d=0;
for (int i=0;i<n;i++){
cin>>arr[i];
}
for (int i=2; i<=q; i++)
{
if (cc[i]==0)
{
ss+=1;
if (ss==arr[d]){
d+=1;
cout<<i<<endl;
}
for (int j=i*i; j<=q; j+=i)
{
cc[j]=1;
}
}
}
return 0;
}
by Gcc_Gdb_7_8_1 @ 2024-11-12 22:36:25
@yanghaoyu123 开什么 long long
?
by xiaokang_suancai @ 2024-11-12 22:36:56
@Gcc_Gdb_7_8_1 确实,但是开
by Gcc_Gdb_7_8_1 @ 2024-11-12 22:39:03
@yanghaoyu123 布什戈们,你读题了吗
by QWQ_HY_DFX @ 2024-11-12 22:52:30
@yanghaoyu123
by QWQ_HY_DFX @ 2024-11-12 22:56:18
@yanghaoyu123
布什戈们,看了眼你的代码,才发现这是什么鬼(
首先,不应该把
其次,题目也没说
by yanghaoyu123 @ 2024-11-14 21:33:30
@QWQ_HY_DFX我这个图省事,把n和q调换了一下
by QWQ_HY_DFX @ 2024-11-14 22:10:53
@yanghaoyu123
主要是