結果

問題 No.1450 nahco314's First Problem
ユーザー iiljj
提出日時 2021-03-31 15:06:04
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 14:15:47
合計ジャッジ時間 1,736 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

// mmap
#include <sys/mman.h>
// write
#include <unistd.h>
// exit
#include <stdio.h>
#include <stdlib.h>

int main() {
    unsigned long long x;
    (void)scanf("%lld", &x);

    for (int m = 0; m < 64; ++m) {
        unsigned long long n = x ^ m;
        if (n <= 0) continue;
        int m2 = __builtin_popcountll(n);
        if (m2 == m) {
            printf("%lld\n", n);
            return 0;
        }
    }

    printf("-1\n");
    exit(0);
    return 0;
}
0