結果

問題 No.1143 面積Nの三角形
ユーザー catuppercatupper
提出日時 2020-07-31 21:59:28
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 800 ms
コード長 1,130 bytes
コンパイル時間 1,194 ms
コンパイル使用メモリ 85,700 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 23:14:30
合計ジャッジ時間 1,685 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

Int ans = 0;
Int n;
vector<Int> divs;
int main(){
    cin >> n;
    for(Int i = 1;i <= n;i++){
        if((n * n) % i)continue;
        divs.push_back(i);
    }
    
    for(Int i = 0;i < divs.size();i++){
        Int x = divs[i];
        for(Int j = i;j < divs.size();j++){            
            Int y = divs[j];
            if(x*y*(x+y) > n*n)break;
            for(Int k = j;k < divs.size();k++){
                Int z = divs[k];
                Int ss = x * y * z * (x + y + z);
                if(ss > n*n)break;
                if(ss == n*n){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0