結果

問題 No.48 ロボットの操縦
ユーザー zuvizudar
提出日時 2016-12-22 00:50:09
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 348 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-14 14:12:11
合計ジャッジ時間 1,333 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
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("%ld%ld%ld",&X,&Y,&L);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(){
	long int X,Y,L,i=0,j=0,ans=0,flag=0;
	scanf("%ld%ld%ld",&X,&Y,&L);

	if(X<0){
		X=-X;
		i++;
	}
	if(Y<0){
		Y=-Y;
		j++;
	}

	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){
		if(j==0)
			ans++;
	}
	if(j!=0)
		ans+=2;
	

printf("%ld\n",ans);
	return 0;
}
0