結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2025-03-26 16:02:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 73 ms / 2,000 ms |
コード長 | 986 bytes |
コンパイル時間 | 3,094 ms |
コンパイル使用メモリ | 190,860 KB |
実行使用メモリ | 34,312 KB |
最終ジャッジ日時 | 2025-03-26 16:02:27 |
合計ジャッジ時間 | 4,024 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘void file()’: main.cpp:24:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | freopen("alive.in","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:25:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | freopen("alive.out","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>#define FOR(i,j,k) for(int i=(j);i<=(k);++i)#define NFOR(i,j,k) for(int i=(j);i>=(k);--i)#define mkp make_pair#define fst first#define sec second#define inl inline#define pb push_back#define el_phy_kongroo return 0using namespace std;typedef long long ll;typedef double db;typedef unsigned int ui;typedef pair< int,int > pii;inline int read(){int s=0,w=1; char ch=getchar();while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar();}while(ch>='0'&&ch<='9') {s=(s<<1)+(s<<3)+ch-'0',ch=getchar();}return s*w;}void file(){freopen("alive.in","r",stdin);freopen("alive.out","w",stdout);}void teltim(int x){clock_t c1=0;if(x) c1=clock();else cerr<<endl<<clock()-c1<<"ms"<<endl;}const int N=2005;int n,k;int nm1[N*N*2];int main(){//file();n=read();k=read();FOR(i,1,n) FOR(j,1,n) nm1[i*i+j*j]++;ll ans=0;FOR(i,1,n) FOR(j,1,n){int x=i*i+k-j*j;if(x>=0) ans+=nm1[x];}printf("%lld",ans);el_phy_kongroo;}