游客 Signup | Login
中文 | En

2473 - 概率论与数理逻辑第3章 第3题

设随机变量(X,Y)的概率密度为:


f(x,y)=    k(9-x-y),     0<x<3, 3<y<6.

                  0 ,            其他

请确定常数k

样例输入N=0,输出1

测试输入N=1,输出k值

<br />

Input

0

Output

1/8

Examples

Input

0

Output

1

Solution C

#include <stdio.h>
 
int main()
{
    int a;
    while(scanf("%d",&a) != EOF)
 {
 if (a==1)
   {
    printf("1/27\n");
   }
 else if (a==0) 
     printf("1\n");	
 
  }
    return 0;
}

Solution C++

#include <iostream>
#include <string>

using namespace std;

int main()
{
  int n ;
  string answer;
 
  while(scanf("%d",&n) != EOF)
  {
    if(n==1)
    {
	  answer = "1/27";
	  cout<<answer<<endl;
    }
    else if(n==0)
    {
      answer = "1";  
	  cout<<answer<<endl;
    }
	
  }
  return 0;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题