結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2017-06-24 19:18:43 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 348 ms |
コンパイル使用メモリ | 31,488 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 03:00:16 |
合計ジャッジ時間 | 1,165 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 4 | main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d%d%d",&X,&Y,&L); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>#include<math.h>#include<stdlib.h>main(){/*北向きから8方向時計回り順に0,1,1,2,2,2,1,1回回転が必要*/int X,Y,L;scanf("%d%d%d",&X,&Y,&L);int step;if(X == 0 && Y >= 0){step = 0;}else if(Y < 0){step = 2;}else{step = 1;}step += ceil(abs(X) / (double)(L));step += ceil(abs(Y) / (double)(L));printf("%d\n",step);}