Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For example, given n = 2, return 1 (2 = 1 + 1); given n = 10, return 36 (10 = 3 +…
Galaxy Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 556 Accepted Submission(s): 127 Special Judge Problem Description Good news for us: to release the financial pressure, the government…
Friend HDU - 1719 Friend number are defined recursively as follows. (1) numbers 1 and 2 are friend number; (2) if a and b are friend numbers, so is ab+a+b; (3) only the numbers defined in (1) and (2) are friend number. Now your task is to judge wheth…
题目链接:http://codeforces.com/problemset/problem/611/B B. New Year and Old Property time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The year 2015 is almost over. Limak is a little polar bear.…
A - A Very Easy Triangle Counting Game Time Limit:1000MS Memory Limit:64000KB 64bit IO Format:%lld & %llu Submit Status Practice ACdream 1008 Description Speedcell and Shoutmon love triangles very much.One day,they are playing a game named “T…
Problem Description You live in a village but work in another village. You decided to follow the straight path between your house (A) and the working place (B), but there are several rivers you need to cross. Assume B is to the right of A, and all…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5312 Sequence Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1336 Accepted Submission(s): 410 Problem Description Today, Soda has learned a…
题目链接:1155 Heap Paths (30 分) In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater than or equal to (in a max heap) or less…
这个题目题意简单,但是TLE得哭哭的... 输入 a b w x c五个数,最终要使得c<=a, 每一秒可以进行一个操作,如果b>=x,则 b=b-x,同时 c--;如果b<x,则a--,c--,b=w-(x-b),最终求满足c<=a时候已经走过的秒数. 我们可以看到,x ,w是里面的定量,b相当于一个控制开关,它的量决定了要进行哪种操作,c在任意一秒都会递减,而a只会在b<x的时候递减,换句话说,b>=x的时候,c和a才差距减少1,我一开始的优化是,分别对于两个条件,…