結果

問題 No.48 ロボットの操縦
ユーザー sukesan_828sukesan_828
提出日時 2016-05-30 20:40:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 23,936 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 18:55:00
合計ジャッジ時間 896 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 0 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 0 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 0 ms
5,376 KB
testcase_17 AC 0 ms
5,376 KB
testcase_18 WA -
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 0 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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("%ld",&x);
      |   ~~~~~^~~~~~~~~~
main.cpp:10:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |   scanf("%ld",&y);
      |   ~~~~~^~~~~~~~~~
main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |   scanf("%ld",&l);
      |   ~~~~~^~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

int main(void){

  long int x,y,l;
  long int n=0;
  scanf("%ld",&x);
  scanf("%ld",&y);
  scanf("%ld",&l);
  if(x < 0){
    n++;
  }
  if( x != 0){
    n += (abs(x)-(abs(x)%l))/l;
    n += (x%l)?1:0;
  }

  if(y < 0){
    n+=2;
  }
  if(y != 0){
    n += (abs(y)-(abs(y)%l))/l;
    n += (y%l)?1:0;
  }

  printf("%ld\n",n);
  return 0;
}







0