結果
問題 | No.113 宝探し |
ユーザー |
![]() |
提出日時 | 2019-07-17 09:37:11 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 591 bytes |
コンパイル時間 | 113 ms |
コンパイル使用メモリ | 29,568 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 22:06:47 |
合計ジャッジ時間 | 996 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
コンパイルメッセージ
main.c: In function 'main': main.c:26:11: warning: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration] 26 | dis = sqrt( ( x * x ) + ( y * y ) ); | ^~~~ main.c:2:1: note: include '<math.h>' or provide a declaration of 'sqrt' 1 | #include <stdio.h> +++ |+#include <math.h> 2 | int main(void){ main.c:26:11: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch] 26 | dis = sqrt( ( x * x ) + ( y * y ) ); | ^~~~ main.c:26:11: note: include '<math.h>' or provide a declaration of 'sqrt'
ソースコード
#include <stdio.h> int main(void){ char move[101]; int x = 0, y = 0; float dis = 0; scanf( "%s", move ); for( int i = 0; i < 101; i++ ){ if( move[i] == '\0' ){ break; } switch( move[i] ){ case 'N': y++; break; case 'S': y--; break; case 'W': x--; break; case 'E': x++; break; } } dis = sqrt( ( x * x ) + ( y * y ) ); printf( "%f", dis ); }