結果

問題 No.1218 Something Like a Theorem
ユーザー totori_nyaa
提出日時 2020-09-11 03:10:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,067 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 195,392 KB
最終ジャッジ日時 2025-01-14 09:25:52
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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 == 1){
        cout << "No\n";
        return 0;
    }

    if(n >= 20){
        cout << "NO\n";
        return 0;
    }
    if(n == 1){
        cout << "Yes\n";
        return 0;
    }
    bool pos = 1;
    vector<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.push_back(now);
    }
    for(auto i:st){
        for(auto j:st){
            if(i+j == z){
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";

}
0