結果
| 問題 |
No.1243 約数加算
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2020-10-02 22:44:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 747 bytes |
| コンパイル時間 | 1,995 ms |
| コンパイル使用メモリ | 200,680 KB |
| 最終ジャッジ日時 | 2025-01-15 00:50:29 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 TLE * 5 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
ll a,b;
cin>>a>>b;
vector<ll> B;
while(a<b){
vector<ll> A;
ll n=a;
for(int i=1;i*i<=n;i++){
if(n%i==0){
A.push_back(i);
if(i*i!=n) A.push_back(n/i);
if(i>=b-a) break;
if(n/i<=b-a) break;
}
}
sort(ALL(A));
auto itr=upper_bound(ALL(A),b-a);
itr--;
a+=*itr;
B.push_back(*itr);
}
cout<<B.size()<<endl;
rep(i,B.size()){
if(i) cout<<" ";
cout<<B[i];
}
cout<<endl;
}
return 0;
}
umezo