結果
| 問題 | No.113 宝探し |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-01 23:07:17 |
| 言語 | C90(gcc12) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 0 ms / 5,000 ms |
| + 707µs | |
| コード長 | 359 bytes |
| 記録 | |
| コンパイル時間 | 52 ms |
| コンパイル使用メモリ | 30,208 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-24 16:49:47 |
| 合計ジャッジ時間 | 1,623 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%s",s);
| ^~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void){
double ns=0,ew=0;
int i,l;
char s[128];
scanf("%s",s);
l = strlen(s);
for(i = 0;i < l;i++){
if(s[i] == 'N'){ns = ns + 1;}
if(s[i] == 'S'){ns = ns - 1;}
if(s[i] == 'E'){ew = ew + 1;}
if(s[i] == 'W'){ew = ew - 1;}
}
ns = sqrt(ns*ns+ew*ew);
printf("%.20lf",ns);
return 0;
}