結果
問題 | No.414 衝動 |
ユーザー | claw88 |
提出日時 | 2016-08-26 23:24:43 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,532 bytes |
コンパイル時間 | 973 ms |
コンパイル使用メモリ | 115,732 KB |
実行使用メモリ | 32,132 KB |
最終ジャッジ日時 | 2024-04-26 03:59:02 |
合計ジャッジ時間 | 2,615 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
31,184 KB |
testcase_01 | AC | 24 ms
23,628 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 23 ms
25,836 KB |
testcase_05 | AC | 52 ms
32,132 KB |
testcase_06 | AC | 52 ms
32,036 KB |
testcase_07 | AC | 23 ms
23,984 KB |
testcase_08 | AC | 41 ms
30,072 KB |
testcase_09 | WA | - |
testcase_10 | AC | 24 ms
23,988 KB |
testcase_11 | AC | 25 ms
23,532 KB |
testcase_12 | WA | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yuki414 { class Program { static void Main(string[] args) { long m = long.Parse(Console.ReadLine()); if (m % 2 == 0) { Console.WriteLine(2+" "+m/2); } else { int n = (int)Math.Sqrt(m); var p = new List<int>(); eratos(p, n); bool flag = true; foreach (var item in p) { if (m % item == 0) { Console.WriteLine(item+" "+m/item); flag = false; break; } } if (flag) { Console.WriteLine(1+" "+m); } } } static void eratos(List<int> P, int n) { var a = new bool[n + 1]; a[0] = a[1] = true; int i; for (i = 2; i * i <= n; i++) { if (a[i]) { P.Add(i); int j = i << 1; while (j <= n) { a[j] = true; j = j + i; } } } for (; i < n; i++) if (!a[i]) P.Add(i); } } }