結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー sasa
提出日時 2025-03-14 11:40:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 427 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 27,392 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-14 11:40:47
合計ジャッジ時間 1,658 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d",&val);
      |         ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	// 入力された値
	int val = 0;
	scanf("%d",&val);
	// 素数サイコロ
	int prime[6]={2,3,5,7,11,13};
	// 合成数サイコロ
	int composite[6]={4,6,8,9,10,12};
	// 入力された値になるパターンをカウント
	double count = 0;
	for(int i = 0;i < 6;i++){
		for(int j = 0;j < 6;j++){
			if(val == prime[i] * composite[j]){
				count++;
			}
		}
	}
	printf("%f",count / 36);
}
0