結果
問題 |
No.800 四平方定理
|
ユーザー |
![]() |
提出日時 | 2019-03-17 22:08:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 617 bytes |
コンパイル時間 | 1,776 ms |
コンパイル使用メモリ | 159,352 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-07 23:29:09 |
合計ジャッジ時間 | 15,506 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 5 TLE * 3 -- * 22 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { double N; ll D; cin >> N >> D; int ans = 0; for(int w = 1; w <= N; w++) { for(int x = 1; x <= min(N,sqrt(w*w + D)); x++) { for(int y = 1; y <= min(N,sqrt(w*w + D - x*x)); y++) { for(int z = 1; z <= min(N,sqrt(w*w + D - x*x - y*y)); z++) { if(x*x + y*y + z*z == w*w + D) { ans++; } } } } } cout << ans << endl; }