結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2016-05-30 20:19:25 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 485 bytes |
コンパイル時間 | 351 ms |
コンパイル使用メモリ | 24,192 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-07 18:51:53 |
合計ジャッジ時間 | 5,561 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d",&x); | ~~~~~^~~~~~~~~ main.cpp:10:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d",&y); | ~~~~~^~~~~~~~~ main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d",&l); | ~~~~~^~~~~~~~~
ソースコード
#include<stdio.h> #include<stdlib.h> int main(void){ int x,y,l; int a=0,b=0; int n=0; scanf("%d",&x); scanf("%d",&y); scanf("%d",&l); int xl = l; 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("%d\n",n); return 0; }