結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-26 17:47:54 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 483 bytes |
| コンパイル時間 | 525 ms |
| コンパイル使用メモリ | 24,448 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2025-03-26 17:47:56 |
| 合計ジャッジ時間 | 1,836 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 22 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d\n%d\n%d",&y,&x,&l);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
void main(void){
int x = 0 , y = 0 , l = 0;
scanf("%d\n%d\n%d",&y,&x,&l);
int turn = 0;
if(y < 0){
y *= -1;
turn += 2;
}else if(y >= 0 && x != 0){
turn += 1;
}else if(y >= 0 && x == 0){
turn = 0;
}
int count = 0;
while(y > 0){
count++;
y -= l;
}
turn += count-1;
while(x > 0){
count++;
x -= l;
}
turn += count-1;
printf("%d",turn);
}
Maeda