結果

問題 No.864 四方演算
ユーザー tonetone
提出日時 2019-08-21 18:40:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 917 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 80,096 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-17 19:29:40
合計ジャッジ時間 3,146 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll A, B;
  std::cin >> A >> B;
  std::vector<ll> candi;
  for(int i=1;i*i<=B;i++){
    if(B%i==0){
      candi.push_back(i);
      if(i*i!=B) candi.push_back(B/i);
    }
  }
  ll ans = 0, reg;
  for(int i=0;i<candi.size();i++){
    //candi
    if(candi[i]>2*A || B/candi[i]>2*A) continue;
    if(candi[i]<=A) reg = candi[i]-1;
    else reg = 2*A-candi[i]+1;
    //B/candi
    if(B/candi[i]<=A) reg *= B/candi[i]-1;
    else reg *= 2*A - B/candi[i]+1;
    ans += reg;
  }
  std::cout << ans << '\n';
  return 0;
}
0