結果

問題 No.567 コンプリート
コンテスト
ユーザー kotatsugame
提出日時 2026-04-02 00:35:26
言語 C11(gcc12 gnu拡張)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=gnu11 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 339 ms / 2,000 ms
コード長 314 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,083 ms
コンパイル使用メモリ 30,024 KB
実行使用メモリ 37,872 KB
最終ジャッジ日時 2026-04-02 00:35:34
合計ジャッジ時間 2,919 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    5 |         scanf("%d",&N);
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | double dp[2][7];
main.c:5:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    5 |         scanf("%d",&N);
      |         ^~~~~
main.c:5:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:19:9: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   19 |         printf("%.9f\n",dp[now][6]);
      |         ^~~~~~
main.c:19:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:19:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
main.c:19:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #
raw source code

double dp[2][7];
int main()
{
	int N;
	scanf("%d",&N);
	int now=0;
	dp[now][0]=1;
	for(int i=0;i<N;i++)
	{
		int nxt=1-now;
		for(int j=0;j<=6;j++)dp[nxt][j]=0;
		for(int j=0;j<=6;j++)
		{
			dp[nxt][j]+=dp[now][j]*j/6;
			if(j<6)dp[nxt][j+1]+=dp[now][j]*(6-j)/6;
		}
		now=nxt;
	}
	printf("%.9f\n",dp[now][6]);
}
0