結果

問題 No.48 ロボットの操縦
ユーザー nanatutmcnanatutmc
提出日時 2019-09-26 23:34:12
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 28,376 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 15:51:28
合計ジャッジ時間 836 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 0 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 WA -
testcase_23 AC 1 ms
4,348 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
    3 | main() {
      | ^~~~

ソースコード

diff #

#include <stdio.h>

main() {
    int X, Y, L;
    int count = 0;
    
    scanf("%d", &X);
    scanf("%d", &Y);
    scanf("%d", &L);
    
    if (Y < 0) {
        count = 2;
        Y = -Y;
    }
    
    count += Y/L;
    if (Y%L > 0)
        count++;
    
    if (X < 0) {
        X = -X;
        count++;
    } else if (X > 0) {
       count++;
    }
    
    count += X/L;
    if (X%L > 0)
        count++;
        
    printf("%d\n", count);
}
0