http://www.bianchengla.com/course/cpp/practise/problem?id=1269
可以计算出投一次可得的分数是1*1/6 + 2 * 1/6 + 3 * 1/6 + 4 * 1/6 + 5 * 1/6 + 6 * 1/6 = 3.5 ;然后n次的期望就是3.5*n;
代码:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> #include <algorithm> #include <queue> #include <math.h> #include <map> #define N 100003 using namespace std ; int d[N] ; int main() { int cas , p , n ; cin>>cas ; while( cas-- ) { cin>>p>>n ; double s = 3.5 * p * n ; printf ( "%.2lf\n" , s ) ; } return 0 ; }