結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
req999999
|
| 提出日時 | 2018-07-11 12:50:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 449 bytes |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 22,528 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-18 18:26:51 |
| 合計ジャッジ時間 | 827 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:4:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
4 | scanf("%d",&x);
| ~~~~~^~~~~~~~~
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d",&y);
| ~~~~~^~~~~~~~~
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d",&l);
| ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
int x,y,l,kaisuu = 0;
scanf("%d",&x);
scanf("%d",&y);
scanf("%d",&l);
if(y<0){
kaisuu+=2;
y = -y;
if(x < 0){
x = -x;
}
} else if(x != 0){
kaisuu++;
if(x < 0){
x = -x;
}
}
if(x != 0){
kaisuu += (x-1)/l+1;
}
if(y != 0){
kaisuu += (y-1)/l+1;
}
printf("%d",kaisuu);
}
req999999