結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-14 18:22:00 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 652 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 23,936 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 08:39:59 |
| 合計ジャッジ時間 | 1,048 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d %d %d",&X,&Y,&L);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
int main(){
//iuput
int X,Y,L;
scanf("%d %d %d",&X,&Y,&L);
//output
int count = 0;
//turn
if (X == 0){
if (Y < 0){
count += 2;
}else{
count += 0;
}
}else{
if (Y < 0){
count += 2;
}else{
count += 1;
}
}
//step
X = abs(X);
Y = abs(Y);
if (X%L == 0){
count += X/L;
}else{
count += (X-X%L)/L+1;
}
if (Y%L == 0){
count += Y/L;
}else{
count += (Y-Y%L)/L+1;
}
//output
printf("%d\n",count);
return 0;
}