結果
| 問題 |
No.211 素数サイコロと合成数サイコロ (1)
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-14 11:44:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 433 bytes |
| コンパイル時間 | 355 ms |
| コンパイル使用メモリ | 28,544 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-14 11:44:22 |
| 合計ジャッジ時間 | 1,821 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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);
| ~~~~~^~~~~~~~~~~
ソースコード
#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