結果
問題 | No.1243 約数加算 |
ユーザー |
|
提出日時 | 2021-07-07 16:20:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,312 bytes |
コンパイル時間 | 2,274 ms |
コンパイル使用メモリ | 196,076 KB |
最終ジャッジ日時 | 2025-01-22 18:00:40 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 9 |
ソースコード
#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 returnusing 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);} 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;}