結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             カルロス
                         | 
                    
| 提出日時 | 2015-07-17 10:32:26 | 
| 言語 | C90  (gcc 12.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 938 bytes | 
| コンパイル時間 | 91 ms | 
| コンパイル使用メモリ | 21,248 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-08 08:21:50 | 
| 合計ジャッジ時間 | 790 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 24 WA * 1 | 
コンパイルメッセージ
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 += 2;
        if(abs(Y)%L==0){
            cnt += abs(Y)/L;
        }else{
            cnt += abs(Y)/L + 1;
        }
        if(X!=0){
            if(abs(X)%L==0){
                cnt += abs(X)/L;
            }else{
                cnt += abs(X)/L + 1;
            }
        }
    }
    printf("%d\n", cnt);
    return 0;
}
            
            
            
        
            
カルロス