結果

問題 No.48 ロボットの操縦
ユーザー zuvizudar
提出日時 2016-12-22 00:15:43
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 348 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 20,480 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 14:10:13
合計ジャッジ時間 1,257 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:17: 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,j,ans=0,flag=0;
		scanf("%ld%ld%ld",&X,&Y,&L);
	if(X<0)
		X=-X;
	if(Y<0){
		Y=-Y;
		flag++;
	}
	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++;
*/	
	if(flag!=0)
		ans+=2;
	printf("%ld\n",ans);
	return 0;
}
0