結果
問題 | No.864 四方演算 |
ユーザー |
![]() |
提出日時 | 2019-08-16 21:48:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 1,005 bytes |
コンパイル時間 | 904 ms |
コンパイル使用メモリ | 95,584 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 10:45:26 |
合計ジャッジ時間 | 1,945 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cassert> #include <cstdint> #include <iostream> #include <iomanip> #include <string> #include <stack> #include <queue> #include <vector> #include <map> #include <set> #include <algorithm> #include <numeric> #include <bitset> using namespace std; using ll = long long; using Pll = pair<ll, ll>; using Pii = pair<int, int>; constexpr ll MOD = 1000000007; constexpr long double EPS = 1e-10; constexpr int dyx[4][2] = { { 0, 1}, {-1, 0}, {0,-1}, {1, 0} }; ll sum_comb(ll s, ll k) { if(k >= s-1) return s-1; if(k+k < s) return 0; return k - (s-k) + 1; } int main() { std::ios::sync_with_stdio(false); cin.tie(0); ll n, k, ans = 0; cin >> n >> k; for(ll i=2;i*i<=k&&i!=k;++i) { // (a+c) if(k % i != 0) continue; ll j = k / i; // (b+d) if(j == 1 || j == k) continue; ans += (i*i == k?1:2) * sum_comb(i, n) * sum_comb(j, n); } cout << ans << endl; }