結果

問題 No.1218 Something Like a Theorem
ユーザー totori_nyaatotori_nyaa
提出日時 2020-09-11 03:09:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 996 bytes
コンパイル時間 3,555 ms
コンパイル使用メモリ 202,940 KB
実行使用メモリ 11,448 KB
最終ジャッジ日時 2023-08-25 21:20:37
合計ジャッジ時間 7,035 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
11,448 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};




signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int n,z;
    cin>>n>>z;
    if(z == 2){
        cout << "Yes\n";
        return 0;
    }
    if(n >= 20){
        cout << "NO\n";
        return 0;
    }
    bool pos = 1;
    set<ll> st;
    for(ll i=1;i<100001;i++){
        ll now = 1;
        bool ok = false;
        for(int j=0;j<n;j++){
            now *= i;
            if(now > 1e6)ok = 1;
        }
        if(ok)break;
        st.insert(now);
    }
    for(auto i:st){
        for(auto j:st){
            if(i+j == z){
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";

}
0