链接:传送门 题意:给两个向量 v1 = { x1 , x2 , x3 , x4 .... } , v2 = { y1 , y2 , y3 , y4 ...... } 允许任意交换 v1 和 v2 各自向量的分量顺序,计算 v1,v2 内积 ( x1 * y1 + x2 * y2 .... )的最小值 思路:根据样例可大胆猜测内积最小值应该为 v1 的最小值 × v2 的最大值 , v1 的次小值 × v2 的次大值 ...... 也就是需要排两次序即复杂度为 O( nlogn )是可以通过大数…
https://code.google.com/codejam/contest/32016/dashboard 题目大意: GCJ(google code jam)上的水题.下周二有比赛,来熟悉熟悉. 有两个向量V1=(x1,x2--xn)和v2=(y1,y2--yn),允许任意交换v1和v2各自的分量顺序,请计算v1和v2的内积x1y1+--xnyn的最小值 思路: 不同于OJ的地方在于有大和小的数据之分,且都是用文件来完成.需要自己下载测试数据,输出的数据用文件保存并且上传. 主函数最前面加…
Problem A. Minimum Scalar Product   This contest is open for practice. You can try every problem as many times as you like, though we won't keep track of which problems you solve. Read the Quick-Start Guide to get started. Problem You are given two v…
今天准备熟悉一下codejam的在线编程,为google的笔试做准备,因此按照codejam上对新手的建议,先用了一个简单的题目来弄清楚流程.记录一下需要注意的地方.   1.输入输出 输入输出重定位即可,拿Minimum Scalar Product这个例子示例如下: #include <iostream>#include <vector>#include <algorithm>#include <functional>#include <cstdi…
题意: 给定两组各n个数,可任意调整同一组数之中数字的顺序,求 sum xi*yi i=1..n的最小值. Small: n<=8 abs xy,yi<=1000 Large: n<=800 abs xi,yi <= 100000 假如两个数字之和为固定,那么两数字之积最大当且仅当两两数字尽量接近. 所以,直觉告诉我们——将x升序排列,y降序排列,所得对应积最大. 因为顺序可以任意调整,所以我们完全可以固定x的数字顺序,仅仅思考y的数字顺序. 验证: 当n=2时: 当仅有两个数的时…
题目描述: 请输出(3+√5)^n整数部分最后3位.如果结果不超过2位,请补足前导0. 分析: 我们最容易想到的方法肯定是直接计算这个表达式的值,但是这样的精度是不够的.朴素的算法没有办法得到答案.但是我们根据分析可以发现这个问题不用求出√5的值也可以得到答案. 我们可以发现,将(3+√5)^n这个式子展开后就是An+Bn√5的形式.同样的,我们将(3-√5)^n这个式子展开后就是An-Bn√5. 因此,(3+√5)^n+(3-√5)^n=2An是一个整数,其中0<(3-√5)^n <1,是解…
Problem C. Numbers This contest is open for practice. You can try every problem as many times as you like, though we won't keep track of which problems you solve. Read the Quick-Start Guide to get started. Small input 15 points Solve C-small   Large…
题目链接:https://code.google.com/codejam/contest/32016/dashboard#s=p0 Minimum Scalar Product This contest is open for practice. You can try every problem as many times as you like, though we won't keep track of which problems you solve. Read the Quick-St…
Problem Introduction The dot product of two sequences \(a_1,a_2,\cdots,a_n\) and \(b_1,b_2,\cdots,b_n\) of the same length is equal to \(\sum\limits_{i=1}^na_ib_i=a_1b_1+a_2b_2+\cdots+a_nb_n\) Problem Description Task.The goal is,given two sequences…
A. Mishka and Game time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in…
A. Home Numbers 题目连接: http://www.codeforces.com/contest/638/problem/A Description The main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with od…
A. Petr and a calendar time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to wee…
A. Dasha and Stairs time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On her way to programming school tiger Dasha faced her first test — a huge staircase! The steps were numbered from one t…
题目链接:https://code.google.com/codejam/contest/4224486/ Problem A. Mushroom Monster 这题题意就是,有N个时间点,每个时间点,Kaylin可以吃掉一定数量的mushroom,Bartholomew可以放入任意数量的mushroom. 现在给出N个时间点分别有多少mushroom. 问:若Kaylin每个时间点可以吃任意数量的mushroom,那为了配合每个时间点的mushroom,Kaylin最少要吃掉多少蘑菇. 问:…
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the current time in 24-hour format hh:mm. Find and print the time after a minutes. Note that you should find only the time after a minutes, see the examples t…
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following way: at first the number 1 is wr…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Gunner Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description Long long ago, there is a gunner whose name is Jack. He likes to go hunting very…
[Problem Description] Problem On the game show The Last Word, the host begins a round by showing the contestant a string S of uppercase English letters. The contestant has a whiteboard which is initially blank. The host will then present the contesta…
A. Buying A House time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us. The gi…
A题和B题...   A. Saitama Destroys Hotel time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to opera…
A. Bear and Big Brother time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Bear Limak wants to become the largest of bears, or at least to become larger than his brother Bob. Right now, Limak…
B. Quasi Binary Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/problem/B Description A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — ar…
A. Cutting Banner Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/problem/A Description A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Un…
A. Lunch Rush time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time u…
A. Pasha and Stick time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of th…
A. Elections time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many peopl…
A. Pineapple Incident time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time.…
---恢复内容开始--- output standard output The final match of the Berland Football Cup has been held recently. The referee has shown n yellow cards throughout the match. At the beginning of the match there were a_1 players in the first team and a_2 players…
https://code.google.com/codejam/contest/544101/dashboard#s=p0     Problem In the exciting game of Join-K, red and blue pieces are dropped into an N-by-N table. The table stands up vertically so that pieces drop down to the bottom-most empty slots in…
B. Equidistant String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her string…