Highways 题目链接: http://acm.hust.edu.cn/vjudge/contest/124434#problem/G Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem an…
POJ 3279 Fliptile(翻格子) Time Limit: 2000MS Memory Limit: 65536K Description - 题目描述 Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an…
题目链接:http://poj.org/problem?id=3259 Wormholes Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 45077 Accepted: 16625 Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is ver…
Highways Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1751 Appoint description: System Crawler (2015-06-02) Description The island nation of Flatopia is perfectly flat. Unfortunately, Flato…
Median Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11599 Accepted: 4112 Description Given N numbers, X1, X2, ... , XN, let us calculate the difference of every pair of numbers: ∣Xi - Xj∣ (1 ≤ i < j ≤ N). We can get C(N,2) differences t…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 题目意思: 有两个class:A 和 B,Bob 在 Class A 里面.现在给出 Class A(n-1人) 和 Class B(m人) 所有人的分数,除了Bob,所以Class A 少了一个人.现在需要找出 Bob 最大可能的分数和最少可能的分数,使得他在Class A 里面拉低平均分,而在Class B 里面提高平均分. 由于数据量不大,所以可以暴力枚…
题目 计算实数a的n次方,具体输出格式看案例 import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); BigDecimal a = BigDecimal.ONE; BigDecimal ans = BigDecimal.ONE; int n; while(in.hasNextBi…
题目链接 Description Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15) of square tiles, each of which…
Description A well known algorithm called heapsort is a deterministic sorting algorithm taking O(n log n) time and O(1) additional memory. Let us describe ascending sorting of an array of different integer numbers. The algorithm consists of two phas…
Information Entropy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Information Theory is one of the most popular courses in Marjar University. In this course, there is an important chapter about information entropy. Entropy is t…
###题目链接### 题目大意: 给你 N 和 K ,在一个 N * N 个图上有 K 个 小行星.有一个可以横着切或竖着切的武器,问最少切多少次,所有行星都会被毁灭. 分析: 将 1~n 行数加入左集合,将 1~n 列数加入右集合.然后将所给的所有点当成无向边,在二分图上连接. 1.对于每条边,只要有其中一个端点被选取,则该条边所代表的行星就可以被摧毁.同样,如果选取了这个端点,则所有与这个端点连接的所有行星都会被一次摧毁. 2.对于样例,假设我选取了 1(左集合)--- 1(右集合) 这条边…
题意: 给你n个点,让你找一个最小的正方形去覆盖所有点.思路: 想一下,如果题目中规定正方形必须和x轴平行,那么我们是不是直接找到最大的x差和最大的y差取最大就行了,但是这个题目没说平行,那么我们就旋转这个正方形,因为是凸性(或者凹性)用三分去枚举正方形的角度[0,PI/2],然后缩小范围,知道找到答案.公式是 nowx = x * cos(du) - y * sin(d) nowy = x * sin(du) + y *cos(d) #include<stdio.…
Description John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mathematics, logic, quantum physics,meteorology, science, computers, and game theory. He wa…