結果
| 問題 | No.3276 Make Smaller Popcount | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-10-19 15:32:25 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 460 bytes | 
| コンパイル時間 | 2,921 ms | 
| コンパイル使用メモリ | 275,448 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-10-19 15:32:39 | 
| 合計ジャッジ時間 | 12,972 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 5 WA * 23 | 
ソースコード
#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<<"-1\n";
        return;
    }
    int pw=1;
    while(pw<n)pw*=2;
    assert(pw!=n);
    cout<<pw-n<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;cin>>t;
    while(t--){
        solve();
    }
}
            
            
            
        