結果
問題 | No.1737 One to N |
ユーザー |
![]() |
提出日時 | 2021-11-13 07:56:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 683 bytes |
コンパイル時間 | 2,126 ms |
コンパイル使用メモリ | 110,924 KB |
実行使用メモリ | 28,124 KB |
最終ジャッジ日時 | 2024-11-26 19:24:04 |
合計ジャッジ時間 | 4,125 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Collections.Generic;using System;public class Hello{static void Main(){var n = int.Parse(Console.ReadLine().Trim());var d = PF(n);var ans = 0;foreach(var x in d) ans += x.Key * x.Value;Console.WriteLine(ans);}static Dictionary<int, int> PF(int n){var d = new Dictionary<int, int>();for (int i = 2; i * i <= n; i++){if (n % i != 0) continue;var x = 0;while (n % i == 0){x++;n /= i;}d[i] = x;}if (n != 1) d[n] = 1;return d;}}