結果
問題 | No.1218 Something Like a Theorem |
ユーザー | kimiyuki |
提出日時 | 2020-09-04 21:32:26 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 647 bytes |
コンパイル時間 | 149 ms |
コンパイル使用メモリ | 10,892 KB |
実行使用メモリ | 7,936 KB |
最終ジャッジ日時 | 2023-08-17 15:03:18 |
合計ジャッジ時間 | 1,244 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,840 KB |
testcase_01 | AC | 16 ms
7,788 KB |
testcase_02 | AC | 15 ms
7,820 KB |
testcase_03 | AC | 16 ms
7,892 KB |
testcase_04 | AC | 16 ms
7,808 KB |
testcase_05 | AC | 15 ms
7,792 KB |
testcase_06 | AC | 16 ms
7,796 KB |
testcase_07 | AC | 16 ms
7,740 KB |
testcase_08 | AC | 15 ms
7,872 KB |
testcase_09 | AC | 16 ms
7,784 KB |
testcase_10 | AC | 16 ms
7,792 KB |
testcase_11 | AC | 16 ms
7,772 KB |
testcase_12 | AC | 16 ms
7,792 KB |
testcase_13 | AC | 16 ms
7,812 KB |
testcase_14 | AC | 15 ms
7,796 KB |
testcase_15 | AC | 15 ms
7,936 KB |
testcase_16 | AC | 16 ms
7,820 KB |
testcase_17 | AC | 15 ms
7,740 KB |
ソースコード
#!/usr/bin/env python3 # from typing import * YES = 'Yes' NO = 'No' # def solve(n: int, z: int) -> str: def solve(n, z): y = z for x in range(1, z + 1): while pow(x, n) + pow(y, n) > pow(z, n) and y >= 1: y -= 1 if y == 0: break if pow(x, n) + pow(y, n) == pow(z, n): return True return False pass # TODO: edit here # generated by online-judge-template-generator v4.6.0 (https://github.com/online-judge-tools/template-generator) def main(): n, z = map(int, input().split()) a = solve(n, z) print(a and YES or NO) if __name__ == '__main__': main()