結果

問題 No.1143 面積Nの三角形
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2020-08-01 11:41:45
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 454 ms / 800 ms
コード長 2,107 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 204,944 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 04:17:49
合計ジャッジ時間 5,549 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 20 ms
4,376 KB
testcase_08 AC 26 ms
4,376 KB
testcase_09 AC 39 ms
4,376 KB
testcase_10 AC 15 ms
4,380 KB
testcase_11 AC 167 ms
4,380 KB
testcase_12 AC 213 ms
4,376 KB
testcase_13 AC 212 ms
4,376 KB
testcase_14 AC 13 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 454 ms
4,376 KB
testcase_17 AC 454 ms
4,376 KB
testcase_18 AC 391 ms
4,376 KB
testcase_19 AC 344 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
vector<ll> enumdiv(ll n) {
	vector<ll> S;
	for (ll i = 1; i * i <= n; i++) if (n % i == 0) { S.push_back(i); if (i * i != n) S.push_back(n / i); }
	sort(S.begin(), S.end());
	return S;
}
ll mul(ll a, ll b) { if (a == 0) return 0; if (infl / a < b) return infl; return min(infl, a * b); }
template<class... T> ll mul(ll x, T... y) { return mul(x, mul(y...)); }
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan0
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














ll N;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	N = N * N;
	auto v = enumdiv(N);
	int ans = 0;
	int n = v.size();
	rep(a, 0, n) {
		int c = n - 1;
		rep(b, a, n) {
			while (b < c && N < mul(v[a], v[b], v[c], v[a] + v[b] + v[c])) c--;
			if (mul(v[a], v[b], v[c], v[a] + v[b] + v[c]) == N && a <= b && b <= c) ans++;
		}
	}
	cout << ans << endl;
}





0