結果
| 問題 |
No.1498 Factorization from -1 to 1
|
| ユーザー |
monnu
|
| 提出日時 | 2021-05-07 23:48:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 815 bytes |
| コンパイル時間 | 1,713 ms |
| コンパイル使用メモリ | 170,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-15 11:53:40 |
| 合計ジャッジ時間 | 7,347 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 -- * 3 |
| other | TLE * 1 -- * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<pair<int,ll>>>;
#define MAX 100001
#define INF 1000000000000000000
#define MOD 1000000007
vector<int> p;
vector<bool> p_table(MAX+1,true);
void prime(){
p_table.at(0)=false,p_table.at(1)=false;
for(int i=2;i<=MAX;i++){
if(p_table.at(i)){
p.push_back(i);
for(int j=2;i*j<=MAX;j++){
p_table.at(i*j)=false;
}
}
}
}
int main(){
prime();
int n=p.size();
int Q;
cin>>Q;
for(int i=0;i<Q;i++){
ll q;
cin>>q;
q=q*q+1;
int j=0;
while(j<n&&j*j<=q){
while(q%(ll)p[j]==0){
cout<<p[j]<<" ";
q/=(ll)p[j];
}
j++;
}
if(q>1){
cout<<q<<" ";
}
cout<<'\n';
}
}
monnu