結果
問題 |
No.800 四平方定理
|
ユーザー |
![]() |
提出日時 | 2019-03-18 03:38:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 314 bytes |
コンパイル時間 | 558 ms |
コンパイル使用メモリ | 63,872 KB |
実行使用メモリ | 34,560 KB |
最終ジャッジ日時 | 2024-07-08 10:01:29 |
合計ジャッジ時間 | 7,000 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 RE * 1 |
other | AC * 2 WA * 11 RE * 17 |
ソースコード
#include <iostream> using namespace std; long long cnt[4000010],n,d,ans = 0; int main(){ int i,j; cin >> n >> d; for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ cnt[i*i+j*j]++; } } for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ if(d - i*i - j*j<=0) continue; ans += cnt[d-i*i-j*j]; } } cout << ans << endl; }