結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
AreTrash
|
| 提出日時 | 2016-06-04 23:56:05 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,197 bytes |
| コンパイル時間 | 2,717 ms |
| コンパイル使用メモリ | 103,168 KB |
| 実行使用メモリ | 18,048 KB |
| 最終ジャッジ日時 | 2024-10-08 10:48:26 |
| 合計ジャッジ時間 | 4,666 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 WA * 11 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace No375{
public class Program{
public static void Main(string[] args){
var N = long.Parse(Console.ReadLine());
var n = N;
var res = 0L;
var tmp = (int)Math.Pow(n, 1.0 / 3.0);
var i = 0;
while(true){
if(n % (tmp + i) == 0){
n /= tmp + i;
res += tmp + i - 1;
break;
}
if(n % (tmp - i) == 0) {
n /= tmp - i;
res += tmp - i - 1;
break;
}
i++;
}
tmp = (int)Math.Sqrt(n);
i = 0;
while(true) {
if(n % (tmp + i) == 0) {
n /= tmp + i;
res += tmp + i - 1;
break;
}
if(n % (tmp - i) == 0) {
n /= tmp - i;
res += tmp - i - 1;
break;
}
i++;
}
res += n - 1;
Console.WriteLine("{0} {1}", res, N - 1);
}
}
}
AreTrash