結果

問題 No.414 衝動
ユーザー hiyokko2hiyokko2
提出日時 2016-08-26 22:50:45
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 1,000 ms
コード長 463 bytes
コンパイル時間 2,232 ms
コンパイル使用メモリ 143,968 KB
実行使用メモリ 4,456 KB
最終ジャッジ日時 2023-08-09 13:22:12
合計ジャッジ時間 2,322 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,380 KB
testcase_01 AC 3 ms
4,396 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 9 ms
4,380 KB
testcase_04 AC 3 ms
4,448 KB
testcase_05 AC 9 ms
4,380 KB
testcase_06 AC 8 ms
4,404 KB
testcase_07 AC 8 ms
4,456 KB
testcase_08 AC 9 ms
4,376 KB
testcase_09 AC 9 ms
4,380 KB
testcase_10 AC 3 ms
4,388 KB
testcase_11 AC 6 ms
4,384 KB
testcase_12 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;

bool is_prime[1000002];
int M;

signed main()
{
	cin >> M;

	for (int i=2; i<=1000001; i++) is_prime[i] = true;
	for (int i=2; i<=1000001; i++) {
		if (is_prime[i]) {
			if (M % i == 0) {
				cout << i << " " << M / i << endl;
				return 0;
			}
			for (int j=i*2; j<=1000001; j+=i) {
				is_prime[j] = false;
			}
		}
	}

	cout << 1 << " " << M << endl;
}
0