/*==============================================================================================================
killprb.c
Kill Probability
1999.09.14
by T.Kubota
===============================================================================================================*/
#include <stdio.h>
#include <math.h>
#define PI 3.141592653589793238462
int main(void)
{
double p; /* sskp */
double q; /* q=1-p */
double pk; /* kill Probability */
double pok; /* over_kill Probability */
double n; /* 発射弾数 */
double m; /* 期待命中弾数 */
printf("********** Kill & Over_Kill Probability\n\n");
printf("SSKP と発射弾数を入力してください。---> ");
scanf("%lf %lf",&p,&n);
q=1-p;
m=n*p;
pk=1-pow(q,n);
pok=1-pow(q,n)*(1+m/q);
printf("\n\nSSKP = %g\n"
"発射弾数 = %g\n"
"平均命中弾数 = %7.5lf\n"
"Kill Prob = %7.5lf\n"
"Over_Kill Prob = %7.5lf\n"
"Over_Kill Ratio= %7.5lf\n",p,n,n*p,pk,pok,pok/pk);
getchar(); getchar();
return 0;
}