結果

問題 No.113 宝探し
ユーザー mosmos_21
提出日時 2016-10-14 00:10:52
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 329 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 23,808 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 03:11:46
合計ジャッジ時間 1,060 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |   scanf("%s", s);
      |   ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <math.h>
int main(){
  int i = 0, x = 0, y = 0;
  char s[101];
  scanf("%s", s);
  while(s[i] != '\0'){
    switch(s[i++]){
    case 'N': y++; break;
    case 'E': x++; break;
    case 'W': x--; break;
    case 'S': y--; break;
    }
  }
  printf("%f\n", sqrt((double)(x * x + y * y)));
  return 0;
}
0