POJ
文章平均质量分 92
记录POJ上的题目和解答
memcpy0
希望探索文理结合的自由之路。
展开
-
POJ 1995 Raising Modulo Numbers【快速幂】
DescriptionPeople are different. Some secretly read magazines full of interesting girls’ pictures, others create an A-bomb in their cellar, others like using Windows, and some like difficult mathematical games. Latest marketing research shows, that this m原创 2021-11-12 02:30:06 · 875 阅读 · 0 评论 -
POJ 3070 Fibonacci【矩阵快速幂】
DescriptionIn the Fibonacci integer sequence, F0=0,F1=1,and Fn=Fn−1+Fn−2 for n≥2F_0 = 0, F_1 = 1, and\ F_n = F_{n − 1} + F_{n − 2}\ \ for\ n ≥ 2F0=0,F1=1,and Fn=Fn−1+Fn−2 for n≥2. For example, the first ten t原创 2021-09-10 10:36:26 · 134 阅读 · 0 评论 -
POJ 3660 Cow Contest【传递闭包】
DescriptionN (1 ≤ N ≤ 100) cows, conveniently numbered 1…N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is unique among the competitors.The contest is co原创 2021-09-08 19:31:03 · 175 阅读 · 0 评论 -
POJ 1975 Median Weight Bead【传递闭包】
DescriptionThere are N beads which of the same shape and size, but with different weights. N is an odd number and the beads are labeled as 1, 2, …, N. Your task is to find the bead whose weight is median (the ((N+1)/2)th among all beads). The following co原创 2021-09-08 19:21:29 · 198 阅读 · 0 评论 -
POJ 2236 Wireless Network【并查集】
DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the network were all broken. The computers are re原创 2020-08-29 19:57:50 · 165 阅读 · 0 评论 -
POJ 2492 A Bug‘s Life【种类并查集】
DescriptionBackgroundProfessor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender. In his experiment, individual bugs and t原创 2020-08-29 15:35:55 · 158 阅读 · 0 评论 -
POJ 1703 Find them, Catch them【种类并查集】
DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify which gang a criminal belongs to. The present quest原创 2020-08-29 13:43:33 · 111 阅读 · 0 评论 -
POJ 1001 A+B Problem 水题
DescriptionCalculate a+b.InputTwo integer a,b (0<=a,b<=10)OutputOutput a+b.Sample Input1 2Sample Output3题目:A+B。思路一 直接加直接用加法。#include <iostream>using namespace std;int main() { int a, b; cin >> a >> b; c原创 2020-06-14 20:39:42 · 214 阅读 · 0 评论 -
POJ 程序设计与算法(二)第09周测验(2020春季) 001:鸣人和佐助【DFS】【剪枝】
文章目录描述思路代码描述佐助被大蛇丸诱骗走了,鸣人在多少时间内能追上他呢?已知一张地图(以二维矩阵的形式表示)以及佐助和鸣人的位置。地图上的每个位置都可以走到,只不过有些位置上有大蛇丸的手下,需要先打败大蛇丸的手下才能到这些位置。鸣人有一定数量的查克拉,每一个单位的查克拉可以打败一个大蛇丸的手下。假设鸣人可以往上下左右四个方向移动,每移动一个距离需要花费 111 个单位时间,打败大蛇丸的手下...原创 2020-04-20 13:32:33 · 488 阅读 · 0 评论 -
POJ 1611 The Suspects【并查集】
DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others.In the Not原创 2020-06-09 14:46:53 · 276 阅读 · 0 评论 -
POJ 2524 Ubiquitous Religions【并查集】
DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university believe in.You know that there are n students i原创 2020-06-09 15:48:53 · 235 阅读 · 0 评论 -
POJ 2692:假币问题 【枚举】
总时间限制: 1000ms内存限制: 65536kB描述赛利有12枚银币。其中有11枚真币和1枚假币。假币看起来和真币没有区别,但是重量不同。但赛利不知道假币比真币轻还是重。于是他向朋友借了一架天平。朋友希望赛利称三次就能找出假币并且确定假币是轻是重。例如: 如果赛利用天平称两枚硬币,发现天平平衡,说明两枚都是真的。如果赛利用一枚真币与另一枚银币比较,发现它比真币轻或重,说明它是假币。经过精...原创 2020-03-13 17:08:19 · 948 阅读 · 0 评论 -
POJ 2810:完美立方 【枚举】
总时间限制:1000ms内存限制:65536kB描述形如a3=b3+c3+d3a^3= b^3 + c^3 + d^3a3=b3+c3+d3的等式被称为完美立方等式。例如123= 63 + 83 + 103 。编写一个程序,对任给的正整数N (N≤100),寻找所有的四元组(a, b, c, d),使得a3=b3+c3+d3a^3= b^3 + c^3 + d^3a3=b3+c3+d3,...原创 2020-03-13 13:44:20 · 228 阅读 · 0 评论 -
POJ 2811:熄灯问题【枚举】
总时间限制: 1000ms内存限制: 65536kB描述有一个由按钮组成的矩阵,其中每行有6个按钮,共5行。每个按钮的位置上有一盏灯。当按下一个按钮后,该按钮以及周围位置(上边、下边、左边、右边)的灯都会改变一次。即,如果灯原来是点亮的,就会被熄灭;如果灯原来是熄灭的,则会被点亮。在矩阵角上的按钮改变3盏灯的状态;在矩阵边上的按钮改变4盏灯的状态;其他的按钮改变5盏灯的状态。...原创 2020-03-13 19:57:24 · 630 阅读 · 0 评论 -
POJ 4148:生理周期【枚举】
文章目录写法一 直接枚举写法二 枚举优化(跳着搜索)最后总时间限制:1000ms内存限制:65536kB描述人生来就有三个生理周期,分别为体力周期、感情周期和智力周期,它们的周期长度分别为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人会在相应的方面表现出色。例如,在智力周期的高峰,人会思维敏捷,注意力容易高度集中。因为三个周期的长度不同,所以通常三个周期的高峰不会落在...原创 2020-03-13 15:39:10 · 499 阅读 · 3 评论 -
POJ 程序设计与算法(二)第02周测验(2020春季) 003:全排列
总时间限制: 1000ms内存限制: 65536kB描述给定一个由不同的小写字母组成的字符串,输出这个字符串的所有全排列。 我们假设对于小写字母有’a’ < ‘b’ < … < ‘y’ < ‘z’,而且给定的字符串中的字母已经按照从小到大的顺序排列。输入输入只有一行,是一个由不同的小写字母组成的字符串,已知字符串的长度在1到6之间。输出输出这个...原创 2020-03-12 13:28:29 · 232 阅读 · 0 评论 -
POJ 程序设计与算法(二)第02周测验(2020春季) 004: 2的幂次方表示【递归】
总时间限制: 1000ms内存限制: 65536kB描述任何一个正整数都可以用2的幂次方表示。例如:137=27+23+20同时约定方次用括号来表示,即ab可表示为a(b)。由此可知,137可表示为:2(7)+2(3)+2(0)进一步:7=22+2+20(21用2表示)3=2+20所以最后137可表示为:2(2(2)+2+2(0))+2(2+2(0))+2(0)...原创 2020-03-12 17:25:45 · 302 阅读 · 0 评论 -
POJ 程序设计与算法(二)第03周测验(2020春季) 001:Boolean Expressions【中缀转后缀并求值】
总时间限制: 1000ms内存限制: 65536kB描述The objective of the program you are going to produce is to evaluate boolean expressions as the one shown next:Expression: ( V | V ) & F & ( F | V )where V is ...原创 2020-03-13 22:15:07 · 376 阅读 · 0 评论 -
POJ 程序设计与算法(二)第04周测验(2020春季) 001:Aggressive cows【二分】
总时间限制: 1000ms内存限制: 65536kB描述Farmer John has built a new long barn, with N(2<=N<=100,000)N (2 <= N <= 100,000)N(2<=N<=100,000) stalls. The stalls are located along a straight li...原创 2020-03-22 14:42:17 · 285 阅读 · 0 评论 -
POJ 程序设计与算法(二)第04周测验(2020春季) 003:月度开销【二分】
总时间限制: 1000ms内存限制: 65536kB描述农夫约翰是一个精明的会计师。他意识到自己可能没有足够的钱来维持农场的运转了。他计算出并记录下了接下来 N(1≤N≤100,000)N (1 ≤ N ≤ 100,000)N(1≤N≤100,000) 天里每天需要的开销。约翰打算为连续的 M(1≤M≤N)M (1 ≤ M ≤ N)M(1≤M≤N) 个财政周期创建预算案,他把一个财政周期...原创 2020-03-22 14:51:59 · 519 阅读 · 0 评论 -
POJ 程序设计与算法(二)第04周测验(2020春季) 002:派 【二分】
总时间限制: 1000ms内存限制: 65536kB描述我的生日要到了!根据习俗,我需要将一些派分给大家。我有 NNN 个不同口味、不同大小的派。有 FFF 个朋友会来参加我的派对,每个人会拿到一块派(必须一个派的一块,不能由几个派的小块拼成;可以是一整个派)。我的朋友们都特别小气,如果有人拿到更大的一块,就会开始抱怨。因此所有人拿到的派是同样大小的(但不需要是同样形状的),虽然这样有些...原创 2020-03-22 14:47:30 · 425 阅读 · 0 评论