結果

問題 No.1218 Something Like a Theorem
ユーザー DriceDrice
提出日時 2020-09-04 23:07:41
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 654 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 31,772 KB
実行使用メモリ 6,896 KB
最終ジャッジ日時 2023-08-17 20:40:35
合計ジャッジ時間 947 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<cstdio>
int have[1000005];

int main(){
    int n; long long z;
    scanf("%d%lld",&n,&z);
    long long need = 1;
    for(int i = 1; i <= n; i++) need *= z;
    for(int i = 1; i < z; i++){
        long long offer = 1;
        int ok = 1;
        for(int j = 1; j <= n; j++){
            offer *= (long long)i;
            if(offer>need){
                ok = 0;
                break;
            }
        }
        if(!ok) break;
        else have[offer] = 1;
    }
    int find = 0;
    for(int i = 1; i < need; i++){
        if(have[i] && have[need-i]) find = 1;
    }
    if(find) printf("Yes\n");
    else printf("No\n");
    return 0;
}
0