結果
| 問題 |
No.864 四方演算
|
| コンテスト | |
| ユーザー |
onakaT_Titai
|
| 提出日時 | 2019-08-16 22:08:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 1,000 ms |
| コード長 | 1,675 bytes |
| コンパイル時間 | 1,151 ms |
| コンパイル使用メモリ | 116,072 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 10:47:24 |
| 合計ジャッジ時間 | 2,295 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using Int = long long;
//using namespace boost::multiprecision;
const double EPS = 1e-10;
long long const MOD = 1000000007;
long long mod_pow(long long x, long long n) {
long long res = 1;
for (int i = 0;i < 60; i++) {
if (n >> i & 1) res = res * x % MOD;
x = x * x % MOD;
}
return res;
}
template<typename T>
T gcd(T a, T b) {
return b != 0 ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
return a * b / gcd(a, b);
}
void fastInput() {
cin.tie(0);
ios::sync_with_stdio(false);
}
vector<long long> Divisor(long long n) {
vector<long long> ret;
for(long long i=1; i*i<=n; i++) {
if(n % i == 0) {
ret.push_back(i);
if(i*i!=n) ret.push_back(n / i);
}
}
return ret;
}
int main(void) {
long long N;
long long K;
cin >> N;
cin >> K;
long long ans = 0;
auto divs = Divisor(K);
sort(divs.begin(), divs.end());
for (auto &i : divs) {
ans += max(0LL, (min(N, i-1) - max(1LL, i-N))+1) * max(0LL, (min(N, K/i-1) - max(1LL, K/i-N))+1);
}
cout << ans << endl;
}
onakaT_Titai