結果

問題 No.1837 Same but Different
コンテスト
ユーザー 👑 tails
提出日時 2022-05-12 21:08:09
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 456 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 96 ms
コンパイル使用メモリ 25,780 KB
最終ジャッジ日時 2026-02-22 09:05:11
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){
      | ^~~~
main.c: In function 'main':
main.c:3:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |         scanf("%ld",&n);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | main(){
main.c:3:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 |         scanf("%ld",&n);
      |         ^~~~~
main.c:3:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:25: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
    5 |                 if(n==3)puts("0 1 11 3 4 5");
      |                         ^~~~
main.c:5:25: note: include '<stdio.h>' or provide a declaration of 'puts'
main.c:9:17: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
    9 |                 exit(0);
      |                 ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
  +++ |+#include <stdlib.h>
    1 | main(){
main.c:9:17: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
    9 |                 exit(0);
      |                 ^~~~
main.c:9:17: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c:19:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   19 |                 printf("%ld ",x+=x==m?6:3);
      |                 ^~~~~~
main.c:19:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:19:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:19:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   2

ソースコード

diff #
raw source code

main(){
	long n;
	scanf("%ld",&n);
	if(n<7){
		if(n==3)puts("0 1 11 3 4 5");
		if(n==4)puts("0 1 2 19 4 5 6 7");
		if(n==5)puts("0 1 2 3 34 6 7 8 9 10");
		if(n==6)puts("0 1 2 3 4 53 8 9 10 11 12 13");
		exit(0);
	}
	// A
	if(n%3==0)puts("0 3");
	if(n%3==1)puts("1 3");
	if(n%3==2)puts("1 4");
	long m=(n*2-7)/3*3;
	long x=9;
	long e=n*3+6;
	while(x<e){
		printf("%ld ",x+=x==m?6:3);
	}
	// B
	long y=4;
	for(long i=0;i<n;++i){
		printf("%ld ",y+=3);
	}
}
0