设为首页 加入收藏

TOP

Uva 11346 Probability 积分
2015-07-20 17:22:40 来源: 作者: 【 】 浏览:1
Tags:Uva 11346Probability积分


化成反比函数求积分


G - Probability

Time Limit: 1 sec
Memory Limit: 16MB

Consider rectangular coordinate system and point L(X,Y) which is randomly chosen among all points in the area A which is defined in the following manner: A = {(x,y) | x is from interval [-a;a]; y is from interval [-b;b]}. What is the probability P that the area of a rectangle that is defined by points (0,0) and (X,Y) will be greater than S?

INPUT:

The number of tests N <= 200 is given on the first line of input. Then N lines with one test case on each line follow. The test consists of 3 real numbers a > 0, b > 0 ir S => 0.

OUTPUT:

For each test case you should output one number P and percentage " %" symbol following that number on a single line. P must be rounded to 6 digits after decimal point.

SAMPLE INPUT:

3
10 5 20
1 1 1
2 2 0

SAMPLE OUTPUT:

 23.348371%
0.000000%
100.000000%

Problem setters: Aleksej Viktorchik, Leonid Shishlo.
Huge Easy Contest #1




/* ***********************************************
Author        :CKboss
Created Time  :2015年01月29日 星期四 22时10分37秒
File Name     :UVA11346.cpp
************************************************ */

#include 
  
   
#include 
   
     #include 
    
      #include 
     
       #include 
      
        #include 
       
         #include 
        
          #include 
         
           #include 
          
            #include 
           
             #include 
             using namespace std; double a,b,s; int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int T_T; scanf("%d",&T_T); while(T_T--) { scanf("%lf%lf%lf",&a,&b,&s); if(s==0) { printf("100.000000%\n"); continue; } else if(a*b<=s) { printf("0.000000%\n"); continue; } double area = log(b)-log(s/a); double mu = 4*a*b; area = s + s*area; area*=4; printf("%.6lf%\n",100.*(1.-area/mu)); } return 0; } 
           
          
         
        
       
      
     
    
   
  



】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇uva 539 The Settlers of Catan(.. 下一篇codeforecs--D. Tanya and Passwo..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Python爬虫教程(从 (2025-12-26 16:49:14)
·【全269集】B站最详 (2025-12-26 16:49:11)
·Python爬虫详解:原 (2025-12-26 16:49:09)
·Spring Boot Java: (2025-12-26 16:20:19)
·Spring BootでHello (2025-12-26 16:20:15)