結果

問題 No.312 置換処理
ユーザー zaichuzaichu
提出日時 2015-12-26 02:59:09
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 822 bytes
コンパイル時間 1,436 ms
コンパイル使用メモリ 166,736 KB
実行使用メモリ 10,944 KB
最終ジャッジ日時 2023-10-19 03:57:52
合計ジャッジ時間 3,730 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
9,044 KB
testcase_01 AC 34 ms
8,320 KB
testcase_02 AC 51 ms
10,892 KB
testcase_03 AC 52 ms
10,892 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 50 ms
10,892 KB
testcase_06 AC 28 ms
7,528 KB
testcase_07 AC 43 ms
9,836 KB
testcase_08 AC 39 ms
9,572 KB
testcase_09 AC 19 ms
6,012 KB
testcase_10 AC 22 ms
6,540 KB
testcase_11 AC 40 ms
9,572 KB
testcase_12 AC 27 ms
7,528 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 RE -
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 1 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 7 ms
4,348 KB
testcase_31 WA -
testcase_32 AC 6 ms
4,348 KB
testcase_33 AC 16 ms
5,484 KB
testcase_34 AC 16 ms
5,484 KB
testcase_35 AC 16 ms
5,484 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 1 ms
4,348 KB
testcase_38 WA -
testcase_39 AC 16 ms
5,484 KB
testcase_40 AC 4 ms
4,348 KB
testcase_41 AC 2 ms
4,348 KB
testcase_42 AC 3 ms
4,348 KB
testcase_43 AC 2 ms
4,348 KB
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    long long int n;
    cin >> n;
    vector<long long int>data(sqrt(n) + 1);
	//	cout << (n - 2) / 2 << endl;
    for(long long int i = 2; i <= sqrt(n); i++){
        data[i] = i;
    }
    for(long long int i = 2; i <= sqrt(n); i++){
        if(data[i]){
            for(long long int j = 0; i * (j + 2) <= sqrt(n); j++){
                data[i * (j + 2)] = 0;
            }
        }
    }
    sort(data.begin(),data.end());
    data.erase(unique(data.begin(),data.end()),data.end());
    for(int i = 0; i < 2; i++) data.erase(data.begin());
    for(int i = 0; i < data.size(); i++){
        if(n % data[i] == 0){
			cout << data[i] << endl;
			return 0;
        }
	}
	if(n % 2 == 0 and n != 4) cout << n / 2 << endl;
	else cout << n << endl;
   	return 0;
}
0