結果
| 問題 | 
                            No.800 四平方定理
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lumefflux
                         | 
                    
| 提出日時 | 2019-03-18 00:45:59 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 508 bytes | 
| コンパイル時間 | 855 ms | 
| コンパイル使用メモリ | 67,672 KB | 
| 最終ジャッジ日時 | 2025-01-06 23:19:44 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 30 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:22:9: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
   22 |     int 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;
    int 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;
        }
    }
    int ans;
    REP(i, 1, 2001)REP(j, 1, 2001){
        ans += c[p[i]+p[j]];
    }
    cout << ans << endl ;
}
            
            
            
        
            
lumefflux