結果
問題 |
No.1218 Something Like a Theorem
|
ユーザー |
![]() |
提出日時 | 2020-09-05 10:23:50 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 95 ms / 2,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 4,907 ms |
コンパイル使用メモリ | 102,656 KB |
実行使用メモリ | 18,176 KB |
最終ジャッジ日時 | 2024-11-27 21:26:58 |
合計ジャッジ時間 | 3,904 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
コンパイルメッセージ
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() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var z = int.Parse(line[1]); if (n == 3) Console.WriteLine("No"); else getAns(n, z); } static void getAns(int n, int z) { var zn = (int)Pow(z, n); for (int i = 1; i <= z; i++) for (int j = i; j <= z; j++) { if ((int)Pow(i, n) + (int)Pow(j, n) == zn) { Console.WriteLine("Yes"); return; } } Console.WriteLine("No"); } }