結果
問題 | No.1243 約数加算 |
ユーザー |
![]() |
提出日時 | 2020-10-06 21:50:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
J_TLE
(最初)
|
実行時間 | - |
コード長 | 832 bytes |
コンパイル時間 | 897 ms |
コンパイル使用メモリ | 94,300 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 03:02:31 |
合計ジャッジ時間 | 3,461 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 9 |
ソースコード
#include<iostream> #include<stdio.h> #include<stdlib.h> #include<algorithm> #include<vector> #include<string.h> #include<math.h> #include<map> #include<iomanip> #include<queue> using namespace std; using ll = long long; using ull = unsigned long long; int main(){ int t; cin >> t; while(t--){ ll a , b; cin >> a >> b; vector<ll> ans; int bit = 1; while((1LL << bit) <= b){ if((a & (1LL << bit)) != 0 && (b & (1LL << bit)) == 0){ a += (1LL << bit); ans.push_back(1LL << bit); } bit++; } while(bit >= 0){ if((a & (1LL << bit)) == 0 && (b & (1LL << bit)) != 0){ a += (1LL << bit); ans.push_back(1LL << bit); } bit--; } cout << ans.size() << endl; for(int i = 0; i < ans.size(); i++){ cout << ans[i] << " "; } cout << endl; //cout << a << endl; } return 0; }