結果
| 問題 |
No.172 UFOを捕まえろ
|
| コンテスト | |
| ユーザー |
umashika
|
| 提出日時 | 2016-02-06 19:51:46 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 378 bytes |
| コンパイル時間 | 463 ms |
| コンパイル使用メモリ | 25,088 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-21 20:52:19 |
| 合計ジャッジ時間 | 1,301 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 15 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d %d %lf",&x,&y,&r);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main(void)
{
int x,y;
double r;
double b=0.0;
scanf("%d %d %lf",&x,&y,&r);
//UFO上の最も遠い距離
double distance = sqrt(x*x+y*y)+r;
//直線と原点の距離(|b|/√2 < distance)
while((double)abs(b)<distance*sqrt(2)){
b = b + 1.0;
}
printf("%d\n",(int)ceil(b));
return 0;
}
umashika