結果
問題 |
No.800 四平方定理
|
ユーザー |
![]() |
提出日時 | 2019-03-18 00:47:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 502 bytes |
コンパイル時間 | 458 ms |
コンパイル使用メモリ | 66,800 KB |
最終ジャッジ日時 | 2025-01-06 23:19:48 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:24:13: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized] 24 | ans += c[p[i]+p[j]]; | ~~~~^~~~~~~~~~~~~~~ main.cpp:22:10: note: ‘ans’ was declared here 22 | long ans; | ^~~
ソースコード
#include <iostream> #define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i ) #define rep(i,n) REP(i,0,n) using namespace std; int main(){ long N, D; cin >> N >> D; long p[2001]; int c[8000001]; REP(i, 1, N + 1){ p[i] = i*i; } REP(i, 1, N + 1)REP(j, 1, N + 1){ int s = p[i] - p[j] + D; if (s >= 1) { c[s] += 1; } } long ans; REP(i, 1, 2001)REP(j, 1, 2001){ ans += c[p[i]+p[j]]; } cout << ans ; }