我希望你是我独家记忆

一段永远封存的记忆,随风而去
posts - 263, comments - 31, trackbacks - 0, articles - 3
   :: 首页 :: 新随笔 ::  :: 聚合  :: 管理

PKU——3682——概率

Posted on 2008-08-31 20:43 Hero 阅读(181) 评论(0)  编辑 收藏 引用 所属分类: 代码如诗--ACM
 1 //PKU 3682 Accepted 220K 0MS C++ 441B 
 2 
 3 //概率题目--看别人报告--至今没有明白为什么这样做
 4 //可怜概率统计学完了马上就又都还给老师了--书到用时方恨少
 5 
 6 #include <stdio.h>
 7 #include <stdlib.h>
 8 #include <string.h>
 9 
10 
11 int ink ;
12 double inp ;
13 
14 double ans1, ans2 ;
15 
16 void input()
17 {
18     scanf( "%lf"&inp ) ;
19 }
20 
21 void process() 
22 {
23     ans1 = ink / inp ;
24     ans2 = (ink+1)*ans1/inp - ans1 ;
25 }
26 
27 void output()
28 {
29     printf( "%0.3lf %0.3lf\n", ans1, ans2 ) ;
30 }
31 
32 int main()
33 {
34     while( scanf( "%d"&ink ) != EOF && ink )
35     {
36         input() ;
37 
38         process() ;
39 
40         output() ;
41     }
42 
43     return 0 ;
44 }

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理