結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2015-05-28 14:03:24 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 391 bytes |
| コンパイル時間 | 122 ms |
| コンパイル使用メモリ | 23,552 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-26 03:09:09 |
| 合計ジャッジ時間 | 1,083 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 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