"BZOJ2134" single-choice dislocation probability DP? It doesn't seem like DP.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.