結果
問題 | No.113 宝探し |
ユーザー | umashika |
提出日時 | 2016-02-06 17:03:00 |
言語 | C90 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 450 bytes |
コンパイル時間 | 111 ms |
コンパイル使用メモリ | 23,680 KB |
最終ジャッジ日時 | 2024-04-28 07:35:01 |
合計ジャッジ時間 | 420 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function ‘main’: main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%s",c); | ^~~~~~~~~~~~~ /usr/bin/ld: /tmp/cc1yymQe.o: in function `main': main.c:(.text.startup+0xef): undefined reference to `sqrt' collect2: error: ld returned 1 exit status
ソースコード
#include<stdio.h> #include<math.h> int main(void) { int south_and_north = 0; int east_and_west = 0; char c[101]; int i; scanf("%s",c); for(i=0;c[i]!='\0';i++){ switch(c[i]){ case 'N':south_and_north++;break; case 'S':south_and_north--;break; case 'E':east_and_west++;break; case 'W':east_and_west--;break; } } printf("%f\n",sqrt(south_and_north*south_and_north+east_and_west*east_and_wes\ t)); return 0; }