結果
| 問題 | 
                            No.211 素数サイコロと合成数サイコロ (1)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             sasa
                         | 
                    
| 提出日時 | 2025-03-14 11:43:09 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 433 bytes | 
| コンパイル時間 | 486 ms | 
| コンパイル使用メモリ | 28,672 KB | 
| 実行使用メモリ | 7,324 KB | 
| 最終ジャッジ日時 | 2025-03-14 11:43:11 | 
| 合計ジャッジ時間 | 1,817 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 25 WA * 8 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:19: warning: format ‘%lf’ expects argument of type ‘double’, but argument 2 has type ‘long double’ [-Wformat=]
   20 |         printf("%lf",count / 36);
      |                 ~~^  ~~~~~~~~~~
      |                   |        |
      |                   double   long double
      |                 %Lf
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);
      |         ~~~~~^~~~~~~~~~~
            
            ソースコード
#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};
	// 入力された値になるパターンをカウント
	long 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("%lf",count / 36);
}
            
            
            
        
            
sasa