A题 #include <sstream> class Solution { public: /** * 返回一个严格四舍五入保留两位小数的字符串 * @param n int整型 n * @return string字符串 */ string Probability(int n) { // write code here if(n==1)return "1.00"; if(n==2)return "0.50"; if(n==3)return "0.25"; if(n==4)return "0.13"; if(n==5)return "0.06"; if(n==6)return "0.03"; if(n==7)return "0.02"; if(n==8)return "0.01"; return "0.00"; } };
全部评论
(0) 回帖