結果

問題 No.113 宝探し
ユーザー Maeda
提出日時 2025-03-25 15:31:37
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 547 bytes
コンパイル時間 895 ms
コンパイル使用メモリ 26,880 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-03-25 15:31:39
合計ジャッジ時間 1,908 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%s",str);
      |     ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#include <math.h>

void main(void){
    double x,y;
    char str[1000] = "a";
    scanf("%s",str);
    for(int i = 0 ; i < (int)strlen(str) ; i++){
        switch(str[i]){
            case 'N':
                x ++;
                break;
            case 'E':
                y++;
                break;
            case 'W':
                y--;
                break;
            case 'S':
                x--;
                break;
        }
    }
    double ans = hypot(x,y);
    printf("%0.5f",ans);
}
0