几何&&数论
文章平均质量分 56
whppmy
博客搬到 bugnull.com
展开
-
2016长城信息杯中国大学生程序设计竞赛中南邀请赛 xtu 1243 2016
http://www.dengwenhuo.cn/?id=194Given a2×2 matrixA=(a 11 a 21 a 12 a 22 ), findA n whereA 1 =A,A n =A×A n−1 . As the result may be large, you are going to find onl原创 2016-06-20 13:44:28 · 1325 阅读 · 2 评论 -
HDU 4710 Balls Rearrangement
Bob has N balls and A boxes. He numbers the balls from 0 to N-1, and numbers the boxes from 0 to A-1. To find the balls easily, he puts the ball numbered x into the box numbered a if x = a mod A.S原创 2015-08-19 15:02:41 · 361 阅读 · 0 评论 -
ZOJ 3876 May Day Holiday
As a university advocating self-learning and work-rest balance, Marjar University has so many days of rest, including holidays and weekends. Each weekend, which consists of Saturday and Sunday, is a r原创 2015-09-06 12:57:22 · 368 阅读 · 0 评论 -
HDU 1143 Tri Tiling
In how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tiling of a 3x12 rectangle. InputInput consists of several test cases followed by a line containing -1.原创 2015-07-14 08:55:00 · 498 阅读 · 0 评论 -
HDU 1021 Fibonacci Again
There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). InputInput consists of a sequence of lines, each containing an integer n. (n < 1,000,000).原创 2015-07-14 09:12:50 · 402 阅读 · 0 评论 -
HDU 1005 Number Sequence
A number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n). InputThe input consi转载 2015-07-14 09:23:26 · 308 阅读 · 0 评论 -
HDU 4704 Sum
Sample Input2 Sample Output2 Hint 1. For N = 2, S(1) = S(2) = 1. 2. The input file consists of multiple test cases. 给定一个数n 将其分解,Si 表示将n拆成i个数的转载 2015-08-05 15:17:14 · 342 阅读 · 0 评论 -
HDU 4722 Good Numbers
If we sum up every digit of a number and the result can be exactly divided by 10, we say this number is a good number. You are required to count the number of good numbers in the range from A to B,原创 2015-08-17 11:17:24 · 419 阅读 · 0 评论 -
HDU 4497 GCD and LCM
Given two positive integers G and L, could you tell me how many solutions of (x, y, z) there are, satisfying that gcd(x, y, z) = G and lcm(x, y, z) = L?Note, gcd(x, y, z) means the greatest common转载 2015-08-05 14:42:26 · 318 阅读 · 0 评论 -
CSU 1030 素数槽
处于相邻的两个素数p和p + n之间的n - 1个连续的合数所组成的序列我们将其称为长度为n的素数槽。例如,‹24, 25, 26, 27, 28›是处于素数23和素数29之间的一个长度为6的素数槽。 你的任务就是写一个程序来计算包含整数k的素数槽的长度。如果k本身就是素数,那么认为包含k的素数槽的长度为0。Input第一行是一个数字n,表示需要测试原创 2015-08-05 15:35:02 · 613 阅读 · 0 评论 -
HDU 4720 Naive and Silly Muggles
Three wizards are doing a experiment. To avoid from bothering, a special magic is set around them. The magic forms a circle, which covers those three wizards, in other words, all of them are inside or原创 2015-08-17 11:13:41 · 402 阅读 · 0 评论 -
HDU 4726 Kia's Calculation
Doctor Ghee is teaching Kia how to calculate the sum of two integers. But Kia is so careless and alway forget to carry a number when the sum of two digits exceeds 9. For example, when she calculates 4原创 2015-08-17 11:15:44 · 403 阅读 · 0 评论 -
2016长城信息杯中国大学生程序设计竞赛中南邀请赛 xtu 1244 Gambling
http://www.dengwenhuo.cn/?id=199In ICPCCamp, gambling is conducted as follow. A player will draw balls from an opaque bag containingared balls,bgreen balls andcblue balls initially. Balls原创 2016-06-20 13:38:37 · 2060 阅读 · 0 评论 -
HDU 1014 Uniform Generator
Computer simulations often require random numbers. One way to generate pseudo-random numbers is via a function of the formseed(x+1) = [seed(x) + STEP] % MODwhere '%' is the modulus operator.转载 2015-07-14 09:03:29 · 534 阅读 · 0 评论 -
ZOJ 2965 Accurately Say "CocaCola"!
In a party held by CocaCola company, several students stand in a circle and play a game.One of them is selected as the first, and should say the number 1. Then they continue to count number from 1 o原创 2015-09-06 15:22:41 · 499 阅读 · 0 评论 -
ZOJ 3785 What day is that day?
It's Saturday today, what day is it after 11 + 22 + 33 + ... +NN days? InputThere are multiple test cases. The first line of input contains an integer T indicating the number of test c原创 2015-09-06 14:36:49 · 630 阅读 · 0 评论 -
UVA 12290 Counting Game
There are n people standing in a line, playing a famous game called \counting". When the game begins,the leftmost person says \1" loudly, then the second person (people are numbered 1 to n from left原创 2015-09-06 15:08:45 · 544 阅读 · 0 评论 -
ZOJ 3326 An Awful Problem
In order to encourage Hiqivenfin to study math, his mother gave him a sweet candy when the day of the month was a prime number. Hiqivenfin was happy with that. But several days later, his mother modif原创 2015-08-06 17:14:37 · 428 阅读 · 0 评论 -
POJ 1050 To the Max
Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangle is the sum of原创 2015-08-05 15:31:03 · 437 阅读 · 0 评论 -
UVA 1587 Box
Ivan works at a factory that produces heavy machinery. He has a simple job -- he knocks up wooden boxes of different sizes to pack machinery for delivery to the customers. Each box is a rectangular原创 2015-08-10 20:27:45 · 528 阅读 · 0 评论 -
ZOJ 3778 Talented Chef
As we all know, Coach Gao is a talented chef, because he is able to cookM dishes in the same time. Tonight he is going to have a hearty dinner with his girlfriend at his home. Of course,Coach Gao原创 2015-09-06 14:34:49 · 568 阅读 · 0 评论 -
ZOJ 3203 Light Bulb
Compared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow and he has only one light bulb in his house. Every night, he is wandering in his incommodious house,原创 2015-08-10 20:38:21 · 396 阅读 · 0 评论 -
HDU 1049 Climbing Worm
An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches原创 2015-07-14 09:35:08 · 365 阅读 · 0 评论 -
URAL 1939 First Seal
Jack: Everyone stay calm! We're taking over the ship.Will: Aye! Avast! Officer: This ship cannot be crewed by two men. You'll never make it out of the bay.Jack: Son... I'm Captain Jack Sparr转载 2015-09-05 17:42:31 · 520 阅读 · 0 评论 -
ZOJ 2403 Stacking Cylinders
Cylinders (e.g. oil drums) (of radius 1 foot) are stacked in a rectangular bin. Each cylinder on an upper row rests on two cylinders in the row below. The cylinders in the bottom row rest on the floor原创 2015-09-05 16:39:49 · 401 阅读 · 0 评论 -
poj 2074 Line of Sight
An architect is very proud of his new home and wants to be sure it can be seen by people passing by his property line along the street. The property contains various trees, shrubs, hedges, and other o原创 2015-08-17 18:00:59 · 558 阅读 · 0 评论 -
poj 1319 Pipe Fitters
A company manufactures pipes of uniform diameter. All pipes are stored in rectangular storage containers, but the containers come in several different sizes. Pipes are stored in rows within a containe转载 2015-08-16 17:27:28 · 499 阅读 · 0 评论 -
poj 1654 Area
You are going to compute the area of a special kind of polygon. One vertex of the polygon is the origin of the orthogonal coordinate system. From this vertex, you may go step by step to the following原创 2015-08-16 18:10:57 · 439 阅读 · 0 评论 -
poj 1673 EXOCENTER OF A TRIANGLE
Given a triangle ABC, the Extriangles of ABC are constructed as follows: On each side of ABC, construct a square (ABDE, BCHJ and ACFG in the figure below). Connect adjacent square corners to form原创 2015-08-17 14:31:48 · 444 阅读 · 0 评论 -
poj 1675 Happy Birthday!
There are three berries on a round birthday cake. You are required to divide the cake into three identical parts such that each part contains exactly one berry. To make it easy, it is assumed that the原创 2015-08-17 14:43:24 · 750 阅读 · 0 评论 -
整数划分
描述整数划分是一个经典的问题。请写一个程序,完成以下要求。 输入每组输入是两个整数n和k。(1 输出对于输入的 n,k;第一行: 将n划分成若干正整数之和的划分数。第二行: 将n划分成k个正整数之和的划分数。第三行: 将n划分成最大数不超过k的划分数。第四行: 将n划分成若干个 奇正整数之和的划分数。第五行: 将n划分成若干不同整数之和的转载 2015-07-20 16:41:38 · 423 阅读 · 0 评论 -
“佐罗”的烦恼
描述说起佐罗,大家首先想到的除了他脸上的面具,恐怕还有他每次刻下的“Z”字。我们知道,一个“Z”可以把平面分为2部分,两个“Z”可以把平面分为12部分,那么,现在的问题是:如果平面上有n个“Z”,平面最多可以分割为几部分呢?说明1:“Z”的两端应看成射线;说明2:“Z”的两条射线规定为平行的。输入输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整原创 2015-06-17 13:05:38 · 766 阅读 · 0 评论 -
NBUT 1223 Friends number
Paula and Tai are couple. There are many stories between them. The day Paula left by airplane, Tai send one message to telephone 2200284, then, everything is changing… (The story in “the snow queen”原创 2015-09-05 18:18:13 · 409 阅读 · 0 评论 -
ZOJ 2748 Free Kick
In a soccer game, a direct free kick is also awarded to the opposing team if a player commits any of the offences.A direct free kick in an immediate distance is a nightmare of the goalie. In order原创 2015-08-06 17:16:41 · 504 阅读 · 0 评论 -
UESTC 169 快快告诉我时间
你知道吗,小明的舅舅是有名的科学家!小明经常在电视上看到舅舅被一大群拿着黑色短棍子的人围着,妈妈说,那是记者们在采访舅舅。小明生日这天舅舅虽然没有来,可是却送来了一个很神秘的礼物。咦,一个哑铃状的装着红色沙子的玻璃管子固定在木头架子上,这是什么东西呢?妈妈说,这个东西叫“沙漏”,是很久很久以前人们用来算时间用的。可是妈妈却没有说人们是怎么用它来算时间的。于是小明开始了研究。小明发现沙漏原创 2015-08-06 17:11:41 · 543 阅读 · 0 评论 -
CSU 1337 搞笑版费马大定理
费马大定理:当n>2时,不定方程an+bn=cn没有正整数解。比如a3+b3=c3没有正整数解。为了活跃气氛,我们不妨来个搞笑版:把方程改成a3+b3=c3,这样就有解了,比如a=4, b=9, c=79时43+93=793。输入两个整数x, y, 求满足xInput输入最多包含10组数据。每组数据包含两个整数x, y(18)。Output对于每组数原创 2015-08-10 19:55:45 · 472 阅读 · 0 评论 -
HDU 1597 find the nth digit
Problem Description假设:S1 = 1S2 = 12S3 = 123S4 = 1234.........S9 = 123456789S10 = 1234567891S11 = 12345678912............S18 = 123456789123456789..................现在我们把所有的串连接起原创 2015-07-14 09:49:12 · 413 阅读 · 0 评论 -
HDU 1249 三角形
用N个三角形最多可以把平面分成几个区域? Input输入数据的第一行是一个正整数T(1 Output对于每组测试数据,请输出题目中要求的结果. Sample Input212 Sample Output28每多一个三角形 其中一条边就和前 N-1个三角形的一两条边相交 所以多了3*2*(N-1)个交点原创 2015-07-14 09:27:46 · 356 阅读 · 0 评论 -
HDU 1052 Tian Ji -- The Horse Racing
Here is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.""Both o原创 2015-07-14 08:46:55 · 464 阅读 · 0 评论 -
UESTC 170 三国
话说在三国时代,曹操曾亲率大军追打刘备,刘备势单力薄,只得向盟友孙权借兵,接下来,我将对这场战争作具体描述。战争发生在中国大陆上(一张二维平面),刘备的大本营在成都,坐标($0$,$0$),曹操的大军和孙权的援兵都驻扎在成都的周围,将用一个坐标点表示,不同地方驻扎的兵力有所不同,但所有人的行进速度都是单位$1$。战争一开始,曹操所有的部队同时向刘备进发,此时幸得诸葛亮神机妙算,知道曹操来了,于是就原创 2015-08-06 17:10:05 · 490 阅读 · 0 评论