結果
問題 |
No.1218 Something Like a Theorem
|
ユーザー |
![]() |
提出日時 | 2020-09-05 21:16:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 998 bytes |
コンパイル時間 | 731 ms |
コンパイル使用メモリ | 94,316 KB |
実行使用メモリ | 7,388 KB |
最終ジャッジ日時 | 2024-11-29 06:08:50 |
合計ジャッジ時間 | 1,349 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
/* -*- coding: utf-8 -*- * * 1218.cc: No.1218 Something Like a Theorem - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ const int MAX_Z = 1000000; /* typedef */ /* global variables */ int ens[MAX_Z + 1]; /* subroutines */ int powi(int a, int n) { int pm = 1; while (n > 0) { if (n & 1) pm *= a; a *= a; n >>= 1; } return pm; } /* main */ int main() { int n, z; scanf("%d%d", &n, &z); for (int y = 1; y <= z; y++) ens[y] = powi(y, n); for (int x = 1; x < z; x++) { int y = lower_bound(ens, ens + z + 1, ens[z] - ens[x]) - ens; if (ens[x] + ens[y] == ens[z]) { puts("Yes"); return 0; } } puts("No"); return 0; }