結果

問題 No.1143 面積Nの三角形
ユーザー tokusakuraitokusakurai
提出日時 2020-07-31 23:28:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 23 ms / 800 ms
コード長 1,434 bytes
コンパイル時間 2,034 ms
コンパイル使用メモリ 199,432 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 03:00:38
合計ジャッジ時間 3,205 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 AC 12 ms
4,376 KB
testcase_10 AC 11 ms
4,380 KB
testcase_11 AC 13 ms
4,376 KB
testcase_12 AC 14 ms
4,380 KB
testcase_13 AC 16 ms
4,380 KB
testcase_14 AC 13 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 20 ms
4,380 KB
testcase_17 AC 23 ms
4,376 KB
testcase_18 AC 22 ms
4,380 KB
testcase_19 AC 22 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(ll i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-5;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll N;
    cin >> N;
    ll n = N*N;
    ll ans = 0;
    rep2(i, 1, N+1){
        if(n%i != 0) continue;
        ll j = n/i;
        for(ll k = 1; k*k*k <= j; k++){
            if(j%k != 0) continue;
            ll s = i-k, t = j/k;
            if(s*s-4*t < 0) continue;
            ld x = sqrt(s*s-4*t);
            ld y = floor(x);
            if(x-y < EPS){
                ll z = y;
                if(z >= s) continue;
                if((s+z)&1) continue;
                ll b = (s+z)/2, c = (s-z)/2;
                if(c >= k) ans++;
            }
        }
    }
    cout << ans << endl;
}
0