結果

問題 No.113 宝探し
コンテスト
ユーザー umashika
提出日時 2016-02-06 16:56:27
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 424 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 146 ms
コンパイル使用メモリ 29,896 KB
最終ジャッジ日時 2026-02-23 20:32:57
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 5 WA * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   scanf("%s",c);
      |   ^~~~~~~~~~~~~

ソースコード

diff #
raw source code

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