結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-03-23 23:41:40 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 300 bytes |
| コンパイル時間 | 149 ms |
| コンパイル使用メモリ | 23,424 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 03:09:10 |
| 合計ジャッジ時間 | 1,114 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);
| ^~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int main() {
char s[101];
scanf("%s",s);
double a=0,b=0;
int i=0;
while(s[i]>='A' && s[i]<='Z') {
if(s[i]=='S') a++;
if(s[i]=='N') a--;
if(s[i]=='E') b++;
if(s[i]=='W') b--;
i++;
}
printf("%.10f\n",sqrt(a*a+b*b));
return 0;
}