結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー hum_op
提出日時 2015-05-22 22:37:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 458 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 23,936 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 05:14:41
合計ジャッジ時間 1,062 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |     scanf("%d", &K);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <cstdio>

int pow(int a, int n){
    if(n == 0) return 1;
    return pow(a, n-1) * a;
}

int main(){
    int K;
    int a[6] = {2,3,5,7,11,13};
    int b[6] = {4,6,8,9,10,12};
    int c = 0;
    
    scanf("%d", &K);
    
    for(int i = 0; i < 6; i++){
        for(int j = 0; j < 6; j++){
            if(a[i] * b[j] == K) c+=2;
        }
    }
    if(c != 0) printf("%f\n", (double)1 / pow(6, c));
    else printf("%f\n", 0.0);
    
    return 0;
}
0