結果

問題 No.48 ロボットの操縦
ユーザー zuvizudar
提出日時 2016-12-22 00:08:49
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 294 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 14:09:01
合計ジャッジ時間 1,275 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |         scanf("%d%d%d",&X,&Y,&L);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(){
	int X,Y,L,i,j,ans=0;
	scanf("%d%d%d",&X,&Y,&L);
	if(X<0)
		X=-X;
	if(Y<0)
		Y=-Y;
	if(X%L==0)
		ans=ans+X/L;
	else
		ans=ans+X/L+1;
	
	if(Y%L==0)
		ans=ans+Y/L;
	else
		ans=ans+Y/L+1;
	
	if(X!=0)
		ans++;
/*	if(Y!=0)
		ans++;
*/	
	printf("%d\n",ans);
	return 0;
}
0