結果

問題 No.1806 Rotating Golem
ユーザー Today03Today03
提出日時 2024-03-21 08:52:46
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 28,928 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-21 08:52:49
合計ジャッジ時間 1,413 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 1 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 1 ms
6,676 KB
testcase_15 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:5:1: warning: return type defaults to 'int' [-Wimplicit-int]
    5 | main(){
      | ^~~~
main.c: In function 'main':
main.c:6:24: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    6 |         char c[5],d[5];scanf("%s",c);scanf("%s",d);
      |                        ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define F(i,n) for(L i=0;i<n;i++)
main.c:6:24: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 |         char c[5],d[5];scanf("%s",c);scanf("%s",d);
      |                        ^~~~~
main.c:6:24: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:2:14: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    2 | #define P(n) printf("%ld\n",(n))
      |              ^~~~~~
main.c:12:9: note: in expansion of macro 'P'
   12 |         P((4+f-e)%4);
      |         ^
main.c:2:14: note: include '<stdio.h>' or provide a declaration of 'printf'
    2 | #define P(n) printf("%ld\n",(n))
      |              ^~~~~~
main.c:12:9: note: in expansion of macro 'P'
   12 |         P((4+f-e)%4);
      |         ^
main.c:2:14: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    2 | #define P(n) printf("%ld\n",(n))
      |              ^~~~~~
main.c:12:9: note: in expansion of macro 'P'
   12 |         P((4+f-e)%4);
      |         ^
main.c:2:14: note: include '<stdio.h>' or provide a declaration of 'printf'
    2 | #define P(n) printf("%ld\n",(n))
      |              ^~~~~~
main.c:12:9: note: in expansion of macro 'P'
   12 |         P((4+f-e)%4);
      |         ^

ソースコード

diff #

#define F(i,n) for(L i=0;i<n;i++)
#define P(n) printf("%ld\n",(n))
#define S(n) scanf("%ld",&(n))
#define L long
main(){
	char c[5],d[5];scanf("%s",c);scanf("%s",d);
	char*str="ESWN";
	L e,f;F(i,4){
		if(str[i]==c[0])e=i;
		if(str[i]==d[0])f=i;
	}
	P((4+f-e)%4);
}
0