4493: Remove Digits 时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte 总提交: 329 测试通过:77 描述 Given an N-digit number, you should remove K digits and make the new integer as large as possible. 输入 The first line has two integers N and K (1 ≤ K<N≤…
描述 Bob loves Pizza but is always out of money. One day he reads in the newspapers that his favorite pizza restaurant, Alfredo's Pizza Restaurant, is running a competition: they will donate a big pizza to the first person who will tell them the lowest…
描述 Did you ever wonder what happens to your money when you deposit them to a bank account? All banks hold such deposits in various assets, such as gold, stocks, obligations, deposits in other banks, loans, bonds, and many others. Due to the financial…
描述 Bessie is playing a number game against Farmer John, and she wants you to help her achieve victory. Game i starts with an integer N_i (1 <= N_i <= 1,000,000). Bessie goes first, and then the two players alternate turns. On each turn, a player can…
描述 The Archeologists of the Current Millenium (ACM) now and then discover ancient artifacts located at vertices of regular polygons. The moving sand dunes of the desert render the excavations difficult and thus once three vertices of a polygon are di…
描述 Background Hello Earthling. We're from the planet Regetni and need your help to make lots of money. Maybe we'll even give you some of it. You see, the problem is that in our world, everything is about integers. It's even enforced by law. No other…
描述 Consider the following two-player game played with a sequence of N positive integers (2 <= N <= 100) laid onto a 1 x N game board. Player 1 starts the game. The players move alternately by selecting a number from either the left or the right end…
描述 Given a sequence, we define the seqence's value equals the difference between the largest element and the smallest element in the sequence. As an example, the value of sequence (3, 1, 7, 2) = 7-1 = 6. Now, given a sequence S, output the sum of all…
描述 The well-known Fibonacci sequence is defined as following: Here we regard n as the index of the Fibonacci number F(n).This sequence has been studied since the publication of Fibonacci's book Liber Abaci. So far, many properties of this sequence ha…
描述 After scrimping and saving for years, Farmer John has decided to build a new barn. He wants the barn to be highly accessible, and he knows the coordinates of the grazing spots of all N (2 ≤ N ≤ 10,000 cows. Each grazing spot is at a point with int…
描述 One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way roads connects pairs of farms; road i requires Ti…
描述 The city executive board in Lund wants to construct a sightseeing tour by bus in Lund, so that tourists can see every corner of the beautiful city. They want to construct the tour so that every street in the city is visited exactly once. The bus s…
描述 给定n个数据,有两个操作,加减其中的一个数据,当然还可查询在某段数据的和. 输入 输入数据有多组,每组数据的第一行输入n,1=<n<=500000,代表数据的个数.第二行输入具体数据,数据为正整数,范围在1到10000.第三行输入m,1<=m<=100000,表示操作的次数.包含了修改和查询操作.下面m行就是具体的操作了.C i x 表示为第i个元素加上x,x范围在1到10000.Q i j 表示查询区段i到j的和.保证输入的i<=j.以EOF结束. 输出 输出查询…
描述 某百货公司仓库中有一批电视机,按其价格严格从低到高的次序,以链表(链表含头结点)的形式存储于计算机中,链表的每个结点表示同样价格的电视机台数.现在又有m台价格为x元的电视机准备入库,请将其加入到链表中(保证价格仍然严格从低到高)完成入库操作. 链表结点(Node类型)包含三个域,分别为价格.数量和指针域: cost num next 题目部分代码已经完成,您只需要补充并提交以下函数: void Add(Node* head, int m, int x);//其中head为链表头指针,m和x…
描述 A 国有 n 座城市,编号从 1 到 n,城市之间有 m 条双向道路.每一条道路对车辆都有重量限制,简称限重.现在有 q 辆货车在运输货物,司机们想知道每辆车在不超过车辆限重的情况下,最多能运多重的货物. 输入 第一行有两个用一个空格隔开的整数 n,m,表示 A 国有 n 座城市和 m 条道路. 接下来 m 行每行 3 个整数 x.y.z,每两个整数之间用一个空格隔开,表示从 x 号城市到 y 号城市有一条限重为 z 的道路.注意:x 不等于 y,两座城市之间可能有多条道路. 接下来一行有…
描述 Bessie was munching on tender shoots of grass and, as cows do, contemplating the state of the universe. She noticed that she only enjoys the grass on the wide expanses of pasture whose elevation is at the base level of the farm. Grass from elevati…
描述 Blackouts and Dark Nights (also known as ACM++) is a company that provides electricity. The company owns several power plants, each of them supplying a small area that surrounds it. This organization brings a lot of problems - it often happens tha…