結果

問題 No.48 ロボットの操縦
ユーザー piyoko_212piyoko_212
提出日時 2015-12-28 23:44:28
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 233 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 33,484 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 18:31:44
合計ジャッジ時間 983 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d%d%d",&a,&b,&c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int ret=0;
	if(b<0)ret+=2;
	else if(a)ret++;
	if(b<0)b=-b;
	if(a<0)a=-a;
	ret+=(a+c-1)/c+(b+c-1)/c;
	printf("%d\n",ret);
}
0