結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
piyoko_212
|
| 提出日時 | 2015-12-28 23:05:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 286 bytes |
| コンパイル時間 | 518 ms |
| コンパイル使用メモリ | 39,636 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-16 21:05:38 |
| 合計ジャッジ時間 | 1,224 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%s",in);
| ~~~~~^~~~~~~~~
ソースコード
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
char in[200];
int main(){
scanf("%s",in);
int x=0;
int y=0;
for(int i=0;in[i];i++){
if(in[i]=='N')x++;
if(in[i]=='S')x--;
if(in[i]=='E')y++;
if(in[i]=='W')y--;
}
printf("%.12f\n",sqrt(x*x+y*y));
}
piyoko_212