結果

問題 No.48 ロボットの操縦
ユーザー Yamyuki
提出日時 2016-12-26 11:18:17
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 223 bytes
コンパイル時間 610 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 23:26:51
合計ジャッジ時間 1,809 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%ld%ld%ld",&x,&y,&l);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#define abs(a) ((a)<0?-(a):(a))
int main(){
	long x,y,l,s=0;
	scanf("%ld%ld%ld",&x,&y,&l);
	if(y<0) s+=2;
	else if(x!=0) s++;
	x=abs(x);
	y=abs(y);
	s+=(x+l-1)/l+(y+l-1)/l;
	printf("%ld\n",s);
	return 0;
}
0