結果
問題 | No.800 四平方定理 |
ユーザー |
![]() |
提出日時 | 2019-06-17 19:16:03 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 1,702 bytes |
コンパイル時間 | 690 ms |
コンパイル使用メモリ | 73,892 KB |
実行使用メモリ | 34,560 KB |
最終ジャッジ日時 | 2024-11-28 03:29:40 |
合計ジャッジ時間 | 2,739 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘void input(int&, R& ...) [with R = {int}]’: main.cpp:27:60: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); } | ~~~~~^~~~~~~~~~ main.cpp: In function ‘void input(int&, R& ...) [with R = {}]’: main.cpp:27:60: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
ソースコード
#pragma region include #include <iostream> #include <vector> #include <algorithm> #include <map> #include <string> #include <queue> #include <stack> #include <cmath> #include <set> #include <cstdio> #include <tuple> #define ALL(obj) (obj).begin(),(obj).end() #define RALL(obj) (obj).rbegin(),(obj).rend() #define REP(i, n) for(int i = 0; i < (int)(n); i++) #define REPR(i, n) for(int i = (int)(n); i >= 0; i--) #define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++) #define MOD 1000000007 #define INF 1000000000 #define LLINF 4000000000000000000 using namespace std; typedef long long ll; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<VI> VVI; void input() {} template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); } template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); } template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); } template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); } template<typename... R> void input(string& f, R&... r) { cin >> f; input(r...); } template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); } #pragma endregion int main() { int N, D; input(N, D); vector<int> cnt(N*N * 2 + 1, 0); int ans = 0; REP(x, N) { REP(y, N) { int a = (x + 1) * (x + 1) + (y + 1) * (y + 1); cnt[a]++; } } REP(z, N) { REP(w, N) { int b = D + (w + 1) * (w + 1) - (z + 1) * (z + 1); if (b >= 0 && b <= N * N * 2) ans += cnt[b]; } } cout << ans << endl; getchar(); getchar(); }