結果
問題 | No.800 四平方定理 |
ユーザー | addeight2 |
提出日時 | 2019-03-18 17:13:06 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 357 bytes |
コンパイル時間 | 1,637 ms |
コンパイル使用メモリ | 150,760 KB |
実行使用メモリ | 83,712 KB |
最終ジャッジ日時 | 2023-09-25 15:00:13 |
合計ジャッジ時間 | 8,420 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
5,248 KB |
testcase_01 | AC | 30 ms
6,352 KB |
testcase_02 | AC | 20 ms
5,400 KB |
testcase_03 | AC | 24 ms
5,760 KB |
testcase_04 | AC | 20 ms
5,316 KB |
testcase_05 | AC | 23 ms
5,764 KB |
testcase_06 | AC | 37 ms
6,944 KB |
testcase_07 | AC | 27 ms
5,984 KB |
testcase_08 | AC | 36 ms
7,116 KB |
testcase_09 | AC | 31 ms
6,372 KB |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | AC | 2 ms
4,384 KB |
testcase_21 | AC | 2 ms
4,384 KB |
testcase_22 | TLE | - |
testcase_23 | TLE | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
#include <bits/stdc++.h> typedef long long ll; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,a) FOR(i,0,a) using namespace std; map<int,int> cnt; int N,D; int main(){ cin>>N>>D; REP(i,N){ REP(j,N){ cnt[(i+1)*(i+1)+(j+1)*(j+1)]++; } } ll ans=0; REP(i,N){ REP(j,N){ ans+=cnt[(i+1)*(i+1)-(j+1)*(j+1)+D]; } } cout<<ans<<endl; }