Posted on 2008-08-31 20:43
Hero 閱讀(193)
評論(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 }