結果
問題 | No.1243 約数加算 |
ユーザー |
|
提出日時 | 2021-07-07 16:21:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,336 bytes |
コンパイル時間 | 2,260 ms |
コンパイル使用メモリ | 196,044 KB |
最終ジャッジ日時 | 2025-01-22 18:00:51 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 1 WA * 8 |
ソースコード
#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)<<endl #define smax(x,y) (x)=max((x),(y)) #define smin(x,y) (x)=min((x),(y)) #define MEM(x,y) memset((x),(y),sizeof (x)) #define sz(x) (int)(x).size() #define RT return using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vll = vector<ll>; void solve() { int T; cin >> T; rep(ITER, T) { vll ans; ll A, B; cin >> A >> B; ll x = 1; while (A % (x * 2) == 0) { x *= 2; } while (A + x <= B) { ans.push_back(x); A += x; x *= 2; } while (A < B) { if (A + x <= B) { ans.push_back(x); A += x; } else { x /= 2; } } cout << sz(ans) << endl; rep(i, sz(ans)) { cout << ans[i] << (i == sz(ans) - 1 ? '\n' : ' '); } } } int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); solve(); return 0; }