結果
問題 | No.1593 Perfect Distance |
ユーザー |
|
提出日時 | 2021-07-09 22:19:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 323 bytes |
コンパイル時間 | 2,146 ms |
コンパイル使用メモリ | 197,200 KB |
最終ジャッジ日時 | 2025-01-22 22:05:30 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; set<long long> Y; for (long long x = 1; x * x < N * N; x++) { Y.insert(N * N - x * x); } long long ans = 0; for (long long y = 1; y <= N; y++) { if (Y.count(y * y)) ans++; } cout << ans << endl; return 0; }