結果
問題 |
No.1593 Perfect Distance
|
ユーザー |
|
提出日時 | 2021-07-09 22:26:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,151 bytes |
コンパイル時間 | 833 ms |
コンパイル使用メモリ | 95,916 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-01 17:04:23 |
合計ジャッジ時間 | 4,975 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 7 WA * 3 TLE * 1 -- * 6 |
ソースコード
#define _USE_MATH_DEFINES #include <iostream> //cin, cout #include <vector> //vector #include <algorithm> //sort,min,max,count #include <string> //string,getline, to_string #include <ios> //fixed #include <iomanip> //setprecision #include <utility> //swap, pair #include <cstdlib> //abs(int) #include <cmath> //sqrt,ceil,M_PI, pow, sin #include <sstream> //stringstream, getline #include <numeric> //gcd, accumlate #include <deque> //deque #include <random> //randam_device #include <limits> //numeric_limits using namespace std; constexpr long long int D_MOD = 1000000007; inline double Calc(int x, int y) { double ans; double temp = sqrt(x * x + y * y); temp = temp * 100; int temp2 = round(temp); ans = temp2 / 100.0; return ans; } int main() { double N; cin >> N; int x = 1, y = 1; int ans = 0; while (1) { y = 1; double n1 = Calc(x, y); if (N == n1) { ans++; break; } else if (n1 > N) { break; } else { while (1) { y++; double n2 = Calc(x, y); if (N == n2) { ans++; break; } else if (n2 > N) { break; } } } x++; } cout << ans << endl; return 0; }