結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2025-03-27 09:15:35 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1,174 ms / 5,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 306 ms |
コンパイル使用メモリ | 24,960 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-27 09:15:38 |
合計ジャッジ時間 | 2,709 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d\n%d\n%d",&x,&y,&l); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> void main(void){ int x = 0 , y = 0 , l = 0; scanf("%d\n%d\n%d",&x,&y,&l); int turn = 0; if(y >= 0 && x == 0){ turn = 0; }else if(y >= 0 && x != 0){ turn += 1; }else if(y < 0){ y *= -1; turn += 2; } if(x < 0){ x *= -1; } int count = 0; while(y > 0){ count++; y -= l; } while(x > 0){ count++; x -= l; } turn += count; printf("%d",turn); }