08 2012 档案
摘要:Runaround NumbersRunaround numbers are integers with unique digits, none of which is zero (e.g., 81362) that also have an interesting property, exemplified by this demonstration:If you start at the left digit (8 in our number) and count that number of digits to the right (wrapping back to the first
阅读全文
摘要:Subset SumsJRM For many sets of consecutive integers from 1 through N (1 #include
using namespace std;
const int mm=2300;
long long f[60][mm];
long long dp(int x,int c)
{ memset(f,0,sizeof(f)); f[1][0]=1;f[1][1]=1; for(int i=2;i=0) f[i][j]=f[i-1][j]+f[i-1][j-i]; else f[i][j]=f[i-1][j]; /*...
阅读全文
摘要:Preface NumberingA certain book's prefaces are numbered in upper case Roman numerals. Traditional Roman numeral values use a single letter to represent a certain subset of decimal numbers. Here is the standard set: I 1 L 50 M 1000 V 5 C 100 X 10 D 500
...
阅读全文
摘要:Hamming CodesRob Kolstad Given N, B, and D: Find a set of N codewords (1 using namespace std;
const int mm=10) { if(z&1) ans++; z>>=1; } return ans;
}
void dfs(int dep)
{ if(dep==a)return; int i,j; for(i=1;i>a>>b>>c; len=1
#include #include #define MAX (1 << 8 + 1)
#de
阅读全文
摘要:Healthy HolsteinsBurch & Kolstad Farmer John prides himself on having the healthiest dairy cows in the world. He knows the vitamin content for one scoop of each feed type and the minimum daily vitamin requirement for the cows. Help Farmer John feed his cows so they stay healthy while minimizing
阅读全文
摘要:Ordered FractionsConsider the set of all reduced fractions between 0 and 1 inclusive with denominators less than or equal to N.Here is the set when N = 5: 0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1
Write a program that, given an integer N between 1 and 160 inclusive, prints the fractions in order o
阅读全文
摘要:The CastleIOI'94 - Day 1 In a stroke of luck almost beyond imagination, Farmer John was sent a ticket to the Irish Sweepstakes (really a lottery) for his birthday. This ticket turned out to have only the winning number for the lottery! Farmer John won a fabulous castle in the Irish countryside.
阅读全文
摘要:Sorting a Three-Valued Sequence IOI'96 - Day 2 Sorting is one of the most frequently performed computational tasks. Consider the special sorting problem in which the records to be sorted have at most three different key values. This happens for instance when we sort medalists of a competition ac
阅读全文
摘要:Checker ChallengeExamine the 6x6 checkerboard below and note that the six checkers are arranged on the board so that one and only one is placed in each row and each column, and there is never more than one in any diagonal. (Diagonals run from southeast to northwest and southwest to northeast and inc
阅读全文
摘要:Superprime RibButchering Farmer John's cows always yields the best prime rib. You can tell prime ribs by looking at the digits lovingly stamped across them, one by one, by FJ and the USDA. Farmer John ensures that a purchaser of his prime ribs gets really prime ribs because when sliced from the
阅读全文
摘要:Prime PalindromesThe number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the same number when read forward as backward). Write a program that finds all prime palindromes in the range of two supplied numbers a and b (5 #include
int f[7]={-1,-1,-1,5,-1,-1,-1};//.
阅读全文
摘要:Ultra-QuickSortTime Limit: 7000MSMemory Limit: 65536KTotal Submissions: 27736Accepted: 9946DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted
阅读全文
摘要:素数价值Time Limit 3000msMemory Limit 65536Kdescription我们来定义下一个数的素数价值,假设这个数是N(2
#include
#include
#define N 50003
using namespace std;
bool noprime[N];
int prime[N];
int num;
int f[N];
void pprim()
{ memset(noprime,0,sizeof(noprime)); noprime[0]=1;noprime[1]=1; num=0; memset(f,0,sizeof(f)); f[...
阅读全文
摘要:Number TrianglesConsider the number triangle shown below. Write a program that calculates the highest sum of numbers that can be passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the left or diagonally down to the right. 7 ...
阅读全文
摘要:Arithmetic ProgressionsAn arithmetic progression is a sequence of the form a, a+b, a+2b, ..., a+nb where n=0,1,2,3,... . For this problem, a is a non-negative integer and b is a positive integer.Write a program that finds all arithmetic progressions of length n in the set S of bisquares. The set of
阅读全文
摘要:三国之战 Time Limit 1000 Memory Limit 65536 description 在三国某某战争中,魏军要围攻蜀国. ,诸葛亮亲自指挥战争,对抗曹操。现假设诸葛亮有N个大炮,每个大炮都有一个攻击值ai(ai>=0 &&ai=0 && x#include#include#include#define N 100030using namespace std;class node{ public: int l,r; int sum,lazy; bool flag;}root[4*N];int shu[N];void build(int t,
阅读全文
摘要:H - A Simple Problem with IntegersCrawling in process...Crawling failedTime Limit:5000MS Memory Limit:131072KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionYou have N integers, A1,A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number
阅读全文
摘要:BillboardTime Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4292 Accepted Submission(s): 2003Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is t
阅读全文
摘要:Mother's MilkFarmer John has three milking buckets of capacity A, B, and C liters. Each of the numbers A, B, and C is an integer from 1 through 20, inclusive. Initially, buckets A and B are empty while bucket C is full of milk. Sometimes, FJ pours milk from one bucket to another until the second
阅读全文
摘要:Tempter of the BoneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 38029 Accepted Submission(s): 10265Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake
阅读全文
摘要:FlowersTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1076 Accepted Submission(s): 535Problem DescriptionAs is known to all, the blooming time and duration varies between different kinds of flowers. Now there is a garden planted full of flowers.
阅读全文
摘要:Man DownTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1171 Accepted Submission(s): 400Problem DescriptionThe Game “Man Down 100 floors” is an famous and interesting game.You can enjoy the game fromhttp://hi.baidu.com/abcdxyzk/blog/item/16398781b
阅读全文
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17672 Accepted Submission(s): 7704Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的
阅读全文
摘要:Keywords SearchTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18580 Accepted Submission(s): 6191Problem DescriptionIn the modern time, Search engine came into the life of everybody like Google, Baidu, etc.Wiskey also wants to bring this feature t
阅读全文

浙公网安备 33010602011771号