結果

問題 No.2979 直角三角形の個数
ユーザー daiota
提出日時 2024-12-03 09:00:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 1,913 ms
コンパイル使用メモリ 166,220 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2024-12-03 09:00:47
合計ジャッジ時間 17,966 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 TLE * 1
other AC * 10 WA * 14 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)




ll gcd(ll a,ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}



int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j;


	ll N;
	cin >> N;


	if(N%2==1 || N<12){
		cout << 0 << endl;
		return 0;
	}


	ll k=N/2;
	ll c=0;
	for(ll n=1;2*n*n<k;n++){
		for(ll m=n+1;2*m*n<k;m++){
			if((m+n)%2==0) continue;
			if(m*(m+n)>k) continue;
			if(gcd(m,n)!=1) continue;




			c+=k/(m*(m+n));

		}
	}



	cout << c << endl;







	return 0;

}
0