結果

問題 No.98 円を描こう
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-08-08 10:14:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 58,452 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 21:59:33
合計ジャッジ時間 1,019 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

int main(void){
	int x, y; cin >> x >> y;
	double d = x * x + y * y;

	// cout << d << endl;
	int ans;
	// cout << sqrt(d) << endl;
	if(sqrt(d) == (int)sqrt(d)){
		ans = 2 * sqrt(d) + 1;
	}else{
		int i = 0;
		// 少しずと大きくしていく調べていく
		while(1){
			if(2 * ((int)sqrt(d) + i) > 2 * sqrt(d)){
				ans = (int)sqrt(d) + i;
				break;
			}
			i++;
		}
	}
	printf("%d\n", ans);
	return 0;
}
0