結果
問題 | No.800 四平方定理 |
ユーザー | asdf1 |
提出日時 | 2019-03-17 21:49:18 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,246 bytes |
コンパイル時間 | 1,575 ms |
コンパイル使用メモリ | 153,532 KB |
実行使用メモリ | 164,468 KB |
最終ジャッジ日時 | 2023-09-22 05:03:15 |
合計ジャッジ時間 | 26,214 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
4,572 KB |
testcase_01 | AC | 15 ms
5,688 KB |
testcase_02 | AC | 11 ms
5,516 KB |
testcase_03 | AC | 13 ms
5,504 KB |
testcase_04 | AC | 10 ms
4,836 KB |
testcase_05 | AC | 13 ms
5,528 KB |
testcase_06 | AC | 17 ms
5,928 KB |
testcase_07 | AC | 13 ms
5,776 KB |
testcase_08 | AC | 19 ms
6,292 KB |
testcase_09 | AC | 16 ms
5,988 KB |
testcase_10 | AC | 1,092 ms
58,820 KB |
testcase_11 | AC | 1,509 ms
82,616 KB |
testcase_12 | AC | 1,512 ms
82,700 KB |
testcase_13 | AC | 1,392 ms
82,588 KB |
testcase_14 | AC | 1,470 ms
82,688 KB |
testcase_15 | AC | 1,449 ms
82,548 KB |
testcase_16 | AC | 1,552 ms
82,840 KB |
testcase_17 | AC | 1,503 ms
82,612 KB |
testcase_18 | AC | 1,440 ms
82,592 KB |
testcase_19 | AC | 1,439 ms
82,636 KB |
testcase_20 | AC | 2 ms
4,376 KB |
testcase_21 | AC | 1 ms
4,376 KB |
testcase_22 | AC | 1,441 ms
82,572 KB |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | AC | 2 ms
4,376 KB |
testcase_27 | AC | 2 ms
4,380 KB |
testcase_28 | TLE | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; const int INF=1e9,MOD=1e9+7,ohara=1e6+10; const ll LINF=1e18; using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define rrep(i,a,b) for(int i=(a);i<(b);i++) #define rrrep(i,a,b) for(int i=(a);i>=(b);i--) #define all(v) (v).begin(), (v).end() #define Size(n) (n).size() #define Cout(x) cout<<(x)<<endl #define Cerr(x) cerr<<(x)<<endl #define fi first #define se second #define P pair<ll,ll> #define m_p make_pair #define V vector<ll> int n,cnt,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos; ld doua; int dy[]={1,0,-1,0}; int dx[]={0,1,0,-1}; //int dy[]={-1,0,1,-1,1,-1,0,1}; //int dx[]={-1,-1,-1,0,0,1,1,1}; string alph("abcdefghijklmnopqrstuvwxyz"),s; bool fl; struct edge{int to,cost;}; unordered_map<int,int> mp; ll ans; //-------------------------↓↓↓↓↓↓------------------------ int main(void){ cin.tie(0); ios::sync_with_stdio(false); //cin>>n>>d; scanf("%d %d",&n,&d); rrep(i,1,n+1){ rrep(j,1,n+1){ mp[i*i-j*j]++; } } rrep(i,1,n+1){ rrep(j,1,n+1){ tmp=i*i+j*j-d; ans+=mp[tmp]; } } //Cout(ans); printf("%d\n",ans); return 0; }