Topic Links:
http://acm.hdu.edu.cn/showproblem.php?pid=5753
Main Topic :
Two sequences H and c,h for the 1~n of the chaotic sequence. H[0]=h[n+1]=0,[a] Indicates that A is true and 1, False is 0.
FunctionF(H)=(i=1~n) ∑CI[HI>HI−1 && < Span id= "mathjax-span-121" class= "Mi" >hi> hi+1
< Span class= "Mi" >< Span class= "mn" >< Span class= "Mtext" > < span class= "Mo" > now given the value of C, ask F (h) for the expectation.
Topic Ideas:
Mathematical
The probability of the tail is 1/2, the probability of the middle is 1/3, the sum directly.
1 //2 //by Coolxxx3 //4#include <iostream>5#include <algorithm>6#include <string>7#include <iomanip>8#include <memory.h>9#include <time.h>Ten#include <stdio.h> One#include <stdlib.h> A#include <string.h> - //#include <stdbool.h> -#include <math.h> the #defineMin (a) < (b) ( A):(B)) - #defineMax (a) (a) > (b)? ( A):(B)) - #defineABS (a) ((a) >0? ( A):(-(a))) - #defineLowbit (a) (a& (a)) + #defineSqr (a) ((a) * (a)) - #defineSwap (a) (a) ^= (b), (b) ^= (a), (a) ^= (b)) + #defineEPS (1E-8) A #defineJ 10000000 at #defineMAX 0x7f7f7f7f - #definePI 3.1415926535897 - #defineN 1004 - using namespacestd; -typedefLong LongLL; - intCas,cass; in intN,m,lll,ans; - intC[n]; to Doubles; + intMain () - { the #ifndef Online_judge * //freopen ("1.txt", "R", stdin); $ //freopen ("2.txt", "w", stdout);Panax Notoginseng #endif - inti,j,l,r,x; the //for (scanf ("%d", &cas); cas;cas--) + //for (scanf ("%d", &cas), cass=1;cass<=cas;cass++) A //while (~scanf ("%s", s)) the while(~SCANF ("%d",&N)) + { -s=0; $ for(i=1; i<=n;i++) $scanf"%d",&c[i]); -s+= (c[1]+c[n])/2.0; - for(i=2; i<n;i++) thes+=c[i]/3.0; -printf"%lf\n", s);Wuyi } the return 0; - } Wu /* - // About $ // - */
View Code
"Math" HDU 5753 permutation Bo