結果
問題 |
No.1585 Cubic Number
|
ユーザー |
![]() |
提出日時 | 2021-07-09 07:24:38 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 1,000 ms |
コード長 | 594 bytes |
コンパイル時間 | 2,857 ms |
コンパイル使用メモリ | 109,040 KB |
実行使用メモリ | 26,060 KB |
最終ジャッジ日時 | 2024-07-01 13:54:15 |
合計ジャッジ時間 | 4,479 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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"); } }