文章列表
PKU 2516 Minimum Cost
- 博客分类:
- Unsolve
Minimum Cost
Time Limit: 4000MS
Memory Limit: 65536K
Total Submissions: 8593
Accepted: 2825
Description
Dearboy, a goods victualer, now comes to a big
problem, and he needs your help. In his sale area there are N shopkeepers
(marked from 1 to N) which stocks goods from h ...
1100. Final Standings
Time Limit: 1.0 second
Memory Limit: 16 MB
Old
contest software uses bubble sort for generating final standings. But
now, there are too many teams and that software works too slow. You are
asked to write a program, which generates exactly the same final
standings a ...
描述 Description
给出长度为N的数列{A_i},每次可以从最左边或者最右边取走一个数,第i次取数得到的价值是i * A_j。求价值之和最大的取数方案。
输入格式 Input Format
第一行,一个整数,表示数列长度N。
接下来N行,每行一个整数,表示数列A_i。
输出格式 Output Format
一个整数,表示最大的价值之和。
算法分析:
设在区间[i,j]按照题目要求取数所获得的最大值为f(i,j),则
f(i,j) = max{f(i+1,j)+a[i]*(n+i-j),f(i,j-1)+a[i]*( ...
tyvj 1348 清理内奸
- 博客分类:
- ACM
清理内奸
描述 Description
最近FF博士在玩一个游戏“三国杀杀杀”,他扮演一个英明的主公,四处清剿反贼。终于把反贼全部干掉了,可是他的手下还存在着一些内奸
。经过他的观察和研究,终于发现了内奸的重要特征。内 ...
http://www.uwp.edu/sws/usaco/
Packing Rectangles
IOI 95
The six basic layouts of four rectangles
Four rectangles are given. Find the smallest enclosing (new) rectangle into which these four may be fitted without overlapping. By smallest rectangle, we mean the one with the smallest area.
All f ...
- 2011-06-21 23:11
- 浏览 803
- 评论(0)
Description
Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm i in the supplied list has a weight Wi (1 ≤ Wi ≤ 400), a 'desirability' factor Di (1 ≤ Di ≤ 100), ...
Calf Flac
To make the programming easier, we keep two copies of the text: the original, and one with the punctuation stripped out. We find the biggest palindrome in the latter copy, and then figure out which part of the original it corresponds to.
To find the biggest palindrome in the alphabetic ...
Barn Repair
题目大意:有S个牛栏,其中有C头牛在里面,一些牛栏有牛,一些没有,最大有M块的板子,每块板子的长度可以任意长,用这些板子去拦住所有的牛,使它们都被围住。求最小会有多少牛栏会被围住。
算法分析:isin[S]:表示第i个牛栏里是否有牛。
v[maxn]:表示连续的没有牛的牛栏数。
设一共有top块连续的牛栏里有牛。则可以知道:如果top<=M,则结果就是所有住有牛的牛栏数;否则的话,就需要通过中间没有牛的牛栏连接两块有牛的区域连起来,我们知道,每次这样做都会使所需用的木板数减少,但同时会增加牛栏数。此时,我们很容易想到我们只需 ...
选课时间(题目已修改,注意读题)
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1038 Accepted Submission(s): 872
Problem Description
又到了选课的时间了,xhd看着选课表发呆,为了想让下一学期好过点,他想知道学n个学分共有多少组合。你来帮帮他吧。(xhd认为一样学分的课没区别)
Input
输入数据的第一行是一个数据T,表示有T组数据。
每组数据的第一行是两个整数n ...
1017. Staircases
Time Limit: 1.0 second
Memory Limit: 16 MB
One curious child has a set of N little bricks (5 ≤ N ≤ 500). From these bricks he builds different staircases. Staircase consists of steps of different sizes in a strictly descending order. It is not allowed for staircase to have steps eq ...
1009. K-based Numbers
Time Limit: 1.0 second
Memory Limit: 16 MB
Let’s consider K-based numbers, containing exactly N digits. We define a number to be valid if its K-based notation doesn’t contain two successive zeros. For example:
1010230 is a valid 7-digit number;
1000198 is not a valid number; ...
1104. Don’t Ask Woman about Her Age
Time Limit: 1.0 second
Memory Limit: 16 MB
Mrs Little likes digits most of all. Every year she tries to make the best number of the year. She tries to become more and more intelligent and every year studies a new digit. And the number she makes is written in numer ...
1091. Tmutarakan Exams
Time Limit: 1.0 second
Memory Limit: 16 MB
University of New Tmutarakan trains the first-class specialists in mental arithmetic. To enter the University you should master arithmetic perfectly. One of the entrance exams at the Divisibility Department is the following. Examinees ...
Cryptography
题目大意:输入一个数n(n<=15000),要求输出第n 个素数。
题目分析:简单题,考察素数筛选法。
代码:
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const int maxn=200010;
int prime[maxn];
int pnum;
void getPrime()
{
pnum=0;
prime[pnum++]=2;
for(int i=3;i&l ...
- 2011-06-05 13:35
- 浏览 749
- 评论(0)
Ural Brave Balloonists
题目大意:给定10个数ai(1<=ai<=10000),m=a1*a2*…*a9*a10,求m的所有正约数的数量sum,输出sum%10.
分析:首先求1~10000内的所有素数,然后分解每一个ai,让对应素数的系数相加得到ei,最后求sum%10=(e1+1)*(e2+1)*…*(e9+1)*(e10+1)%10.
涉及算法:素数筛选法及分解质因数
代码:
#include <iostream>
#include <cmath>
#include <cstdio>
using names ...