結果

問題 No.1218 Something Like a Theorem
ユーザー bluemegane
提出日時 2020-09-04 22:47:57
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 1,962 ms
コンパイル使用メモリ 110,208 KB
実行使用メモリ 26,384 KB
最終ジャッジ日時 2024-11-26 20:42:34
合計ジャッジ時間 3,528 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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.

ソースコード

diff #

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]);
        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");
    }
}
0