結果
問題 |
No.278 連続する整数の和(2)
|
ユーザー |
![]() |
提出日時 | 2015-09-05 14:16:45 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 879 bytes |
コンパイル時間 | 2,570 ms |
コンパイル使用メモリ | 106,544 KB |
実行使用メモリ | 34,176 KB |
最終ジャッジ日時 | 2024-07-19 03:48:42 |
合計ジャッジ時間 | 6,240 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 TLE * 1 -- * 15 |
コンパイルメッセージ
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; class Program { static void Main() { Int64 n = Int64.Parse(Console.ReadLine()); Int64 temp = n * ( n - 1 )/2; Int64 i ; Int64 ans; var list = new List<Pair>(); i = 2; while(temp != 1) { Int64 count = 0; while (temp % i == 0) { count++; temp /= i; } if (count > 0) list.Add(new Pair(i, count)); i++; } ans = 1; foreach (Pair p in list) { ans *= ((Int64)(Math.Pow(p.x, p.n+1)) - 1) / (p.x - 1); } Console.WriteLine(ans); } } struct Pair { public Int64 x; public Int64 n; public Pair(Int64 x, Int64 n) { this.x = x; this.n = n; } }