結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2016-02-06 16:56:27 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 424 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 23,808 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 20:50:04 |
合計ジャッジ時間 | 1,244 ms |
ジャッジサーバー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); | ^~~~~~~~~~~~~
ソースコード
#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; }