結果
| 問題 | No.1585 Cubic Number |
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2021-07-09 07:24:38 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 1,000 ms |
| コード長 | 594 bytes |
| 記録 | |
| コンパイル時間 | 3,417 ms |
| コンパイル使用メモリ | 111,112 KB |
| 実行使用メモリ | 26,828 KB |
| 最終ジャッジ日時 | 2026-03-22 15:46:13 |
| 合計ジャッジ時間 | 5,341 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using static System.Math;
using System;
public class Hello
{
static void Main()
{
var n = long.Parse(Console.ReadLine().Trim());
getAns(n);
}
static void getAns(long n)
{
var p = Pow(n, 1 / 3d);
var ans1 = (long)p;
var ans2 = ans1 + 1L;
var ans3 = ans1 - 1L;
if (ans1 * ans1 * ans1 == n) { Console.WriteLine("Yes"); return; }
if (ans2 * ans2 * ans2 == n) { Console.WriteLine("Yes"); return; }
if (ans3 * ans3 * ans3 == n) { Console.WriteLine("Yes"); return; }
Console.WriteLine("No");
}
}
bluemegane