結果
| 問題 | 
                            No.1243 約数加算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             mmn15277198
                         | 
                    
| 提出日時 | 2020-10-06 21:45:47 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 832 bytes | 
| コンパイル時間 | 849 ms | 
| コンパイル使用メモリ | 94,428 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-20 03:02:14 | 
| 合計ジャッジ時間 | 2,997 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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 = 0;
		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;
}
            
            
            
        
            
mmn15277198