結果
問題 |
No.800 四平方定理
|
ユーザー |
![]() |
提出日時 | 2019-03-14 14:39:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 386 bytes |
コンパイル時間 | 712 ms |
コンパイル使用メモリ | 66,944 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-01 19:36:34 |
合計ジャッジ時間 | 4,511 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 10 TLE * 1 -- * 19 |
ソースコード
#include<iostream> #include<vector> using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) const int MAX = 7e6; bool quad[MAX]; int main(){ int n; cin>>n; int d; cin>>d; rep(i,n)quad[(i+1)*(i+1)+d]=1; int ans=0; REP(i,1,n+1)REP(j,1,n+1)REP(k,1,n+1){ if(quad[i*i+j*j+k*k]){ ++ans; } } cout<<ans<<endl; return 0; }