Accepted
Code
#include<bits/stdc++.h>
using namespace std;
const long long M=2e5+1,MOD=1000000007;
typedef long long ll;
vector<int>prime;
void precalculate_prime(){
prime.push_back(2);
for(ll i=3;i*i<=1e9;i+=2){
int x=1;
for(auto it:prime){
if(it*it>i)break;
if(i%it==0){
x=0;
break;
}
}
if(x)prime.push_back(i);
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
precalculate_prime();
int t=1;
cin>>t;
while(t--){
int n;
cin>>n;
int res=1;
for(auto it:prime){
if(n%it==0){
res=n/it;
break;
}
}
cout<<res<<"\n";
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1052 Yet Another Array Partition
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-04-23 16:03:28
- Judged At
- 2024-04-29 15:10:10
- Judged By
- Score
- 100
- Total Time
- 97ms
- Peak Memory
- 796.0 KiB