Power Member
|
#include <iostream>
#include <algorithm>
#include <vector>
#include <time.h>
#include <windows.h>
#include <process.h>
#include <math.h>
using namespace std;
int main(int argc, char *argv[]) {
typedef std::vector<int> vector_type;
vector_type sta(10), stb(10);
for (int i = 0 ;i < 7;i++) {
sta[i] = 1;
stb[i] = 1;
}
srand(GetTickCount() + _getpid());
int j = 0, m = 0;
float n = 900000;
for (int k = 0 ;k < n;k++) {
random_shuffle(sta.begin(), sta.end());
random_shuffle(stb.begin(), stb.end());
int p = 0;
for (int i = 0 ;i < 10;i++) {
j += ((sta[i] + stb[i]) != 0);
p += ((sta[i] + stb[i]) != 0);
}
m += (p == 10);
}
cout << "十題中任一題兩人中任一人答對機率:" << j / (10*n) << endl;
cout << "十題中每一題兩人中任一人答對機率:" << m / n << endl;
system("pause");
return 0;
}
十題中任一題兩人中任一人答對機率:0.909892
十題中每一題兩人中任一人答對機率:0.2909
哈 假設自己不會寫的題目去抄隔壁的(自己只有7成會隔壁也是7成功力) 答題命中率達到91%
但是要抄到滿分 卻有3成命中率
此題要出成題組告誡同學 抄也是會加分的 70%-->>91% 這就是一分努力一分收穫嗎!!!
不過滿分卻往往是自己努力
|