結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
カルロス
|
| 提出日時 | 2015-07-17 10:30:30 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 954 bytes |
| コンパイル時間 | 117 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-08 08:21:48 |
| 合計ジャッジ時間 | 843 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d %d %d", &X, &Y, &L);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
int main(void){
int cnt = 0, X, Y, L;
scanf("%d %d %d", &X, &Y, &L);
if(Y>0){
if(Y%L==0){
cnt += Y/L;
}else{
cnt += Y/L + 1;
}
if(X!=0){
cnt++;
if(abs(X)%L==0){
cnt += abs(X)/L;
}else{
cnt += abs(X)/L + 1;
}
}
}else if(Y==0){
if(X!=0){
cnt++;
if(X%L==0){
cnt += X/L;
}else{
cnt += X/L + 1;
}
}
}else{
cnt++;
if(abs(Y)%L==0){
cnt += abs(Y)/L;
}else{
cnt += abs(Y)/L + 1;
}
if(X!=0){
cnt++;
if(abs(X)%L==0){
cnt += abs(X)/L;
}else{
cnt += abs(X)/L + 1;
}
}
}
printf("%d\n", cnt);
return 0;
}
カルロス