1 piblic Double Solution(int n) 2 { 3 Dounle ret = 0; 4 for(int i = 1;i <= n;i++) 5 { 6 int dishu = 1; 7 for(int j = 1;j <= n;j++) 8 { 9 dishu *= j; 10 } 11 ret += 1 / (Do uble)dishu; 12 } 13 return ret; 14 }
时间: 2024-11-07 07:40:21
1 piblic Double Solution(int n) 2 { 3 Dounle ret = 0; 4 for(int i = 1;i <= n;i++) 5 { 6 int dishu = 1; 7 for(int j = 1;j <= n;j++) 8 { 9 dishu *= j; 10 } 11 ret += 1 / (Do uble)dishu; 12 } 13 return ret; 14 }