結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2015-07-17 10:34:18 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 953 bytes |
コンパイル時間 | 140 ms |
コンパイル使用メモリ | 21,632 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 18:22:09 |
合計ジャッジ時間 | 852 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d %d %d", &X, &Y, &L); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> int main(void){ int cnt = 0, X, Y, L; scanf("%d %d %d", &X, &Y, &L); if(Y>0){ if(Y%L==0){ cnt += Y/L; }else{ cnt += Y/L + 1; } if(X!=0){ cnt++; if(abs(X)%L==0){ cnt += abs(X)/L; }else{ cnt += abs(X)/L + 1; } } }else if(Y==0){ if(X!=0){ cnt++; if(abs(X)%L==0){ cnt += abs(X)/L; }else{ cnt += abs(X)/L + 1; } } }else{ cnt += 2; if(abs(Y)%L==0){ cnt += abs(Y)/L; }else{ cnt += abs(Y)/L + 1; } if(X!=0){ if(abs(X)%L==0){ cnt += abs(X)/L; }else{ cnt += abs(X)/L + 1; } } } printf("%d\n", cnt); return 0; }