結果

問題 No.113 宝探し
ユーザー dai11dai11
提出日時 2017-08-03 09:47:37
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 2,040 ms
コンパイル使用メモリ 157,724 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 20:20:35
合計ジャッジ時間 2,271 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 3 WA * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%s",S);
      |         ~~~~~^~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(int argc, char **argv)
{
	char S[100]; //入力される文字列(N,E,W,S)
	int i;      //ループカウンタ
	int counter = 0; //移動した値
	
	scanf("%s",S);
	for(i = 0;i < strlen(S);i++)
	{
	 if('N' == S[i])
	 {
		 counter++;
	 }
	 else if('E' == S[i])
	 {
		 counter++;
	 }
	 else if('S' == S[i])
	 {
		 counter++;
	 }
	 else if('W' == S[i])
	 {
		 counter++;
	 }
	}
	printf("%0.5f\n",sqrt(counter));
	return 0;
}
0