# ZOJ-3640-Help me escape

Source: Internet
Author: User

ZOJ-3640-Help me escape

Http://acm.zju.edu.cn/onlinejudge/showProblem.do? Problemcode = 3640.

A vampire has n routes for him. Each time he takes a random route, each route has a limit. If the attack power of this vampire is greater than or equal to a certain value, it will take t days to escape. Otherwise, it will take 1 day and increase the attack power and ask him what he expects to escape.

`# Include <iostream >#include <cstdio >#include <cstring >#include <cstdlib> # include <cmath> using namespace STD; int C [105]; int T [105]; int V [20010]; double F [20010]; int N; double Sol (INT at) {int I; If (V [at]) return f [at]; V [at] = 1; F [at] = 0; for (I = 1; I <= N; I ++) if (at> C [I]) f [at] + = T [I]; elsef [at] + = Sol (at + C [I]) + 1; f [at]/= N; return f [at];} int main () {int I, ff; while (scanf ("% d", & N, & ff )! = EOF) {for (I = 1; I <= N; I ++) scanf ("% d", & C [I]); for (I = 1; I <= N; I ++) T [I] = (INT) (1 + SQRT (5.0) * 0.5 * C [I] * C [I]); memset (v, 0, sizeof (v); printf ("%. 3lf \ n ", Sol (ff);} return 0 ;}`
Related Keywords:

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.