結果

問題 No.48 ロボットの操縦
ユーザー yamaken1343
提出日時 2015-11-01 21:59:08
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 296 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 24,832 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 06:53:34
合計ジャッジ時間 934 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
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("%d%d%d",&x,&y,&l);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

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