結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー jin128
提出日時 2016-08-26 14:15:36
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 792 ms / 5,000 ms
コード長 398 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 181 ms
コンパイル使用メモリ 29,736 KB
最終ジャッジ日時 2026-02-23 22:18:11
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   scanf("%d%d%d",&x, &y, &l);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

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

int main(){
  int x, y, l;
  int count = 0;
  scanf("%d%d%d",&x, &y, &l);

  if(abs(x) > 0)
    count ++;
  if(y < 0)
    count = 2;

  int i;
  for(i = 0; ; i++){
    if(abs(x) <= l * i){
      count += i;
      break;
    }
  }

  for(i = 0; ; i++){
    if(abs(y) <= l * i){
      count += i;
      break;
    }
  }

  printf("%d\n",count);
  return 0;

}
0