結果

問題 No.48 ロボットの操縦
ユーザー yamaken1343
提出日時 2015-11-01 22:10:53
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 311 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 24,448 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 06:45:47
合計ジャッジ時間 1,126 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%ld%ld%ld",&x,&y,&l);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main(void){
	long x,y,l;
	double tmp,ans;
	scanf("%ld%ld%ld",&x,&y,&l);
	
	tmp = labs(x)/(double)l;
	ans += ceil(tmp);
	tmp = labs(y)/(double)l;
	ans += ceil(tmp);
	ans += 1;
	if(x==0 && y>0) ans--;
	if(y<0)ans++;
	
	printf("%.0f\n",ans);
	return 0;
}
0