Reprint Please specify source: http://blog.csdn.net/vmurder/article/details/42879121
Test instructions: After I have entered, I have the correct options for AI, and there are ai-1 options that someone might choose and how many questions to expect.
The expectation of the problem is irrelevant to the two questions.
Only need to discuss each question separately
A correct option, b possible option
For some of the right options, someone has a 1/b probability of doing the right thing.
Total odds: 1/b/a.
The correct option for this is min (A, b).
Well, that's it.
Code:
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define N 10001000using namespace Std;int n,a,b,c,a[n];int main () {double ans=0;scanf ("%d%d%d%d%d", &n,&a,&b,&c , a+1); for (int i=2;i<=n;i++) a[i]= ((Long Long) a[i-1]*a+b)%100000001;for (int i=1;i<=n;i++) a[i]=a[i]%c+1;a[0]=a [N];for (int i=1;i<=n;i++) ans+=1.00000/(double) max (A[i-1],a[i]);p rintf ("%.3lf\n", ans); return 0;} /* If there is a selection method for a topic, the answer to the correct answer is min (A, b) * (1/a)/b or 1/max (A, b); */
"BZOJ2134" single-choice dislocation probability DP? It doesn't seem like DP.