結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2015-05-28 14:02:22 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 389 bytes |
| コンパイル時間 | 417 ms |
| コンパイル使用メモリ | 23,808 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-06 12:06:46 |
| 合計ジャッジ時間 | 1,255 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 23 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%s", s);
| ^~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int main(void) {
int i, x = 0, y = 0;
char s[101];
scanf("%s", s);
printf("%s\n", s);
i = 0;
while(s[i] != '\0'){
switch(s[i]){
case 'N':
x--;
break;
case 'S':
x++;
break;
case 'E':
y++;
break;
case 'W':
y--;
break;
}
i++;
}
//printf("%d %d\n", x, y);
printf("%f\n", sqrt(x * x + y * y));
return 0;
}
suppy193