結果

問題 No.375 立方体のN等分 (1)
ユーザー AreTrashAreTrash
提出日時 2016-06-04 23:12:00
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,009 bytes
コンパイル時間 2,635 ms
コンパイル使用メモリ 114,248 KB
実行使用メモリ 29,192 KB
最終ジャッジ日時 2024-04-17 01:04:43
合計ジャッジ時間 3,655 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
18,560 KB
testcase_01 AC 28 ms
18,560 KB
testcase_02 WA -
testcase_03 AC 27 ms
18,688 KB
testcase_04 AC 27 ms
18,560 KB
testcase_05 AC 27 ms
18,432 KB
testcase_06 AC 28 ms
18,560 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 41 ms
18,588 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
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 WA -
testcase_23 AC 63 ms
18,944 KB
testcase_24 AC 64 ms
19,072 KB
testcase_25 WA -
testcase_26 AC 65 ms
19,200 KB
testcase_27 WA -
testcase_28 AC 64 ms
19,200 KB
testcase_29 AC 64 ms
19,200 KB
testcase_30 AC 65 ms
19,072 KB
testcase_31 AC 64 ms
19,200 KB
testcase_32 AC 64 ms
19,200 KB
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace No375{
    public class Program{
        public static void Main(string[] args){
            var N = long.Parse(Console.ReadLine());
            var input = N;
            var rl = new List<int>();
            var res = 0L;

            if(input > 1){
                var nl = Enumerable.Range(2, (int)Math.Sqrt(input) + 1).ToList();
                var sqrt = (int)Math.Sqrt(Math.Sqrt(input)) + 1;
                while(nl[0] <= sqrt){
                    var prime = nl[0];
                    rl.Add(prime);
                    nl.RemoveAll(value => value % prime == 0);
                }
                rl.AddRange(nl);

                foreach(var i in rl) {
                    while(N % i == 0) {
                        N /= i;
                        res += i - 1;
                    }
                }
            }

            res += N - 1;
            Console.WriteLine("{0} {1}", res, input - 1);
        }
    }
}
0