結果

問題 No.1243 約数加算
ユーザー kotatsugame
提出日時 2020-10-02 21:43:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 69,732 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-16 04:35:20
合計ジャッジ時間 1,187 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
int T;
main()
{
	cin>>T;
	for(;T--;)
	{
		long A,B;cin>>A>>B;
		vector<long>X;
		while(A<B)
		{
			long t=1;
			while(A+t*2<=B&&A%(t*2)==0)t*=2;
			A+=t;
			X.push_back(t);
		}
		cout<<X.size()<<endl;
		for(int i=0;i<X.size();i++)cout<<X[i]<<(i+1==X.size()?"\n":" ");
	}
}
0