結果

問題 No.48 ロボットの操縦
ユーザー 184
提出日時 2014-10-23 22:33:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 288 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 13:05:20
合計ジャッジ時間 1,500 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         int x,y,l;scanf("%d%d%d",&x,&y,&l);
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

using namespace std;
//namaega 184

int main(){
	
	int x,y,l;scanf("%d%d%d",&x,&y,&l);
	int ans=0;
	if(x!=0)ans+=1,ans+=(abs(0-x)+l-1)/l;
	if(y<0){ans++;if(x==0)ans++;}
	ans+=(abs(0-y)+l-1)/l;
	
	printf("%d\n",ans);
	
	
	return 0;
}
0