結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-12-30 23:56:07 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 377 bytes |
| コンパイル時間 | 413 ms |
| コンパイル使用メモリ | 23,936 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 03:09:10 |
| 合計ジャッジ時間 | 1,165 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%s",s);
| ^~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<math.h>
int main()
{
char s[101]={0};
int x=0,y=0,i;
double d;
scanf("%s",s);
for (i=0;i<101;i++) {
switch(s[i]) {
case 'N' :
y++;
break;
case 'E' :
x++;
break;
case 'W' :
x--;
break;
case 'S' :
y--;
break;
}
}
d=sqrt(x*x+y*y);
printf("%f\n",d);
return 0;
}