結果

問題 No.3276 Make Smaller Popcount
コンテスト
ユーザー Facade
提出日時 2025-10-19 15:30:55
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 3,209 ms
コンパイル使用メモリ 275,268 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-19 15:31:06
合計ジャッジ時間 10,473 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int inf=1e18;
void solve(){
    int n;cin>>n;
    int cnt=0;
    for(int i=0;i<31;i++){
        cnt+=((n>>i)&1);
    }
    if(cnt==1){
        cout<<"No\n";
        return;
    }
    int pw=1;
    while(pw<n)pw*=2;
    assert(pw!=n);
    cout<<pw-n<<"\n";
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;cin>>t;
    while(t--){
        solve();
    }
}
0