結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
asdf1
|
| 提出日時 | 2019-03-17 21:49:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,246 bytes |
| コンパイル時間 | 1,206 ms |
| コンパイル使用メモリ | 167,172 KB |
| 実行使用メモリ | 164,796 KB |
| 最終ジャッジ日時 | 2024-07-07 21:46:19 |
| 合計ジャッジ時間 | 25,966 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 TLE * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:53:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
53 | printf("%d\n",ans);
| ~^ ~~~
| | |
| int ll {aka long long int}
| %lld
main.cpp:40:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
40 | scanf("%d %d",&n,&d);
| ~~~~~^~~~~~~~~~~~~~~
ソースコード
#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;
}
asdf1