結果

問題 No.1498 Factorization from -1 to 1
ユーザー MaHanMaHan
提出日時 2021-05-05 03:16:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 402 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 63,480 KB
実行使用メモリ 7,796 KB
最終ジャッジ日時 2023-10-01 05:16:11
合計ジャッジ時間 5,340 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 41 ms
4,380 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdlib>

typedef long long LL;

int main() {
	LL Q;
	LL* q;
	
	std::cin >> Q;
	q = (LL*)malloc(sizeof(LL)*Q);
	for (int i = 0; i < Q; i++) {
		std::cin >> q[i];
		q[i] = q[i]*q[i]+1;
	}
	
	for (int i = 0; i < Q; i++) {
		for (int p = 2; p <= q[i]; p++) {
			while (q[i]%p == 0) {
				std::cout << p << ' ';
				q[i]/=p;
			}
		}
		std::cout << std::endl;
	}
	return 0;
}
0