結果

問題 No.1243 約数加算
ユーザー SSRSSSRS
提出日時 2020-10-02 21:28:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 527 bytes
コンパイル時間 1,968 ms
コンパイル使用メモリ 200,276 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-23 04:09:22
合計ジャッジ時間 3,739 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int T;
  cin >> T;
  for (int i = 0; i < T; i++){
    long long A, B;
    cin >> A >> B;
    vector<long long> ans;
    while (1){
      long long d = B - A;
      if (d == 0){
        break;
      }
      long long add = A / ((A + d - 1) / d);
      ans.push_back(add);
      A += add;
      if (ans.size() >= 120){
        break;
      }
    }
    int K = ans.size();
    cout << K << endl;
    for (int j = 0; j < K; j++){
      cout << ans[j] << endl;
    }
  }
}
0