求N以内的真分数个数 For example, if N = 5, the number of possible irreducible fractions are 11 as below. 0 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1 Input Output 代码: #include <iostream> #include <cstdio> using namespace std; #define _DEBUG 0 #define MAX 10…
Count primes Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2719 Accepted Submission(s): 1386 Problem Description Easy question! Calculate how many primes between [1...n]! Input Each line…
5152. Brute-force Algorithm EXTREME Problem code: BFALG Please click here to download a PDF version of the contest problems. The problem is problem B in the PDF. But the data limits is slightly modified: 1≤P≤1000000 in the original description, but i…
投资组和求最大利润 题目: 投资人出资一笔费用mount,投资给不同的公司(A,B,C....),求最大获取利润? 例如:投资400百万,给出两家公司A和B: 1.如果投资一百万给A公司,投资3百万给B工资,则获取14百万(5百万+9百万): 2.如果都投资给B公司,则获取15百万,所以应该投资给B公司: 故选择全部投给B公司. Invested Amount(Unit: KRW 100 million won) Company A Company B 条件: 1.给出投资额mount,以及公司…
Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a beautiful brick wall with a perfec…
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. Hint: How many majority elements could it possibly have? Do you have a better hint? Suggest it! 这道题让我们…
Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 5646 Accepted: 1226 Description In an edge-weighted tree, the xor-length of a path p is defined as the xor sum of the weights of edges on p: ⊕ is the xor operator. We say a path the xor-l…