結果
問題 | No.1593 Perfect Distance |
ユーザー |
|
提出日時 | 2021-07-09 22:08:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 907 bytes |
コンパイル時間 | 2,462 ms |
コンパイル使用メモリ | 192,712 KB |
最終ジャッジ日時 | 2025-01-22 21:54:34 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; template<typename T> ostream& operator<<(ostream &os, vector<T> &v){ string sep = " "; if(v.size()) os << v[0]; for(int i=1; i<v.size(); i++) os << sep << v[i]; return os; } template<typename T> istream& operator>>(istream &is, vector<T> &v){ for(int i=0; i<v.size(); i++) is >> v[i]; return is; } #ifdef DBG void debug_(){ cout << endl; } template<typename T, typename... Args> void debug_(T&& x, Args&&... xs){ cout << x << " "; debug_(forward<Args>(xs)...); } #define dbg(...) debug_(__VA_ARGS__) #else #define dbg(...) #endif int main() { ios_base::sync_with_stdio(false); cout << setprecision(20) << fixed; ll n; cin >> n; ll ans = 0; for(ll i=1; i<n; i++){ ll y = round(sqrt(n*n - i*i)); if(y*y == n*n-i*i) ans++; } cout << ans << endl; return 0; }