結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー mono1977
提出日時 2016-12-04 02:10:51
言語 C90
(gcc 12.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 351 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 245 ms
コンパイル使用メモリ 21,828 KB
最終ジャッジ日時 2026-01-15 14:58:28
合計ジャッジ時間 952 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:24: error: C++ style comments are not allowed in ISO C90
   10 |                 inst=2;//y+ -> x+ or x- -> y-
      |                        ^
main.c:10:24: note: (this will be reported only once per input file)
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d%d%d",&x,&y,&l);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

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

int main(){
	int x,y,l;
	int inst;
	scanf("%d%d%d",&x,&y,&l);
	
	if(y<0){
		inst=2;//y+ -> x+ or x- -> y-
	}else if(y>=0 && x==0){
		inst=0;//y+
	}else{
		inst=1;//y+ -> x+ or x-
	}
	
	inst += (int)ceil((double)abs(x)/(double)l);
	inst += (int)ceil((double)abs(y)/(double)l);
		
	printf("%d\n",inst);
	
	return 0;
}
0