結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
sukesan_828
|
| 提出日時 | 2016-05-30 20:26:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 516 bytes |
| コンパイル時間 | 385 ms |
| コンパイル使用メモリ | 24,448 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 19:25:50 |
| 合計ジャッジ時間 | 5,617 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%ld",&x);
| ~~~~~^~~~~~~~~~
main.cpp:12:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%ld",&y);
| ~~~~~^~~~~~~~~~
main.cpp:13:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%ld",&l);
| ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h>
#include<stdlib.h>
int main(void){
long int x,y,l;
long int a=0,b=0;
long int n=0;
scanf("%ld",&x);
scanf("%ld",&y);
scanf("%ld",&l);
long int xl = l;
long int yl = l;
while(a != x || b != y){
if(x < 0 && xl > 0){
xl *= -1;
}
else if( a != x){
a += (abs(x-a)<l)?(x-a):xl;
}
else if(y < 0 && yl > 0){
n++;
yl *= -1;
}
else if(b != y){
b += (abs(y-b)<l)?(y-b):yl;
}
n++;
}
printf("%ld\n",n);
return 0;
}
sukesan_828