結果
| 問題 | No.98 円を描こう |
| コンテスト | |
| ユーザー |
kichirb3
|
| 提出日時 | 2018-03-05 23:32:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 522 bytes |
| 記録 | |
| コンパイル時間 | 644 ms |
| コンパイル使用メモリ | 69,216 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-13 19:26:33 |
| 合計ジャッジ時間 | 1,241 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 6 |
ソースコード
// No.98 円を描こう
// https://yukicoder.me/problems/no/98
//
#include <iostream>
#include <cmath>
using namespace std;
int solve(int xp, int yp);
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int xp, yp;
cin >> xp >> yp;
int ans = solve(xp, yp);
cout << ans << endl;
}
int solve(int xp, int yp) {
double r = sqrt(xp*xp + yp*yp);
double d = r * 2;
int ans = ceil(d);
if (pow((ans/2), 2) == pow(xp, 2) + pow(yp, 2))
++ans;
return ans;
}
kichirb3