#define NDEBUG #undef __STRICT_ANSI__ #include #include #include #include #include #include #include #include #include #include using namespace std; #undef assert #define assert(e) #include #include class XsRandom { unsigned long long a; unsigned long long b; public: inline XsRandom() : a(0x8a5cd789635d2dffULL), b(0x121fd2155c472f96ULL) { } inline XsRandom(const XsRandom & o) : a(o.a), b(o.b) { } inline unsigned long long next64() { unsigned long long c = a ^ (a<<23); a = b; b = c ^ a ^ (c>>18) ^ (a>>5); return b + a; } inline XsRandom(unsigned int seed) : a(0x8a5cd789635d2dffULL), b(0x121fd2155c472f96ULL) { seed = seed * 1234567891 + 521288629; unsigned long long a2 = a; unsigned long long b2 = b; while(seed) { next64(); if(seed & 1) { a2 ^= a; b2 ^= b; } seed >>= 1; } a = a2; b = b2; } inline unsigned int next() { return (unsigned int)next64(); } inline int nextInt(int r) { assert(1<=r); return ((unsigned long long)next() * r)>>32; } }; typedef XsRandom MyRandom; MyRandom g_myRand; double g_startTime; double g_suspendTime = 0; const double g_timeupSecBase = 9.8; double g_timeupSec = g_timeupSecBase; #include const char * nextCLineOrWord(int mode) { static char buf[65536]; static int bufLen = sizeof(buf); static int bufPos = sizeof(buf); static bool canReadFlag = true; static bool crFlag = false; static bool enterFlag = false; if(canReadFlag && (enterFlag ? bufLen<=bufPos : (int)sizeof(buf)<=bufPos+bufPos)) { if(0 vec(101); vec[p0] = win; for(int i=0; i<100; ++i) { vector vec2(101); for(int p=0; p<101; ++p) { double p1 = vec[p] * p / 200; double p2 = vec[p] * (100-p) / 300; win += p1 + p2; vec2[max(0, p-q)] += p1; vec2[min(p+q, 100)] += p2; } vec = vec2; } echoln("%.10f", win); return 0; }