![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
OJ
无知的渣渣
无论是从无知到有知,还是一个渣渣的逆袭,都是需要付出的。。。
展开
-
XTU1004 Unique Snowflakes
Emily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captures snowflakes as they fall, and serializes them into a stream of snowflakes that flow, one by one, into a package. Once the package is f原创 2017-04-18 15:15:38 · 321 阅读 · 0 评论 -
XTU 1263 Super Resolution 2017年“嘉杰信息杯” 中国大学生程序设计竞赛全国邀请赛(湖南)
Super ResolutionBobo has an n×m picture consists of black and white pixels. He loves the picture so he would like to scale it a×b times. That is, to replace each pixel with a×b block of pixels with the same color (see the example for clarity).InputThe原创 2017-05-15 10:55:50 · 1417 阅读 · 0 评论 -
XTU 1268 Strange Optimization 2017年“嘉杰信息杯” 中国大学生程序设计竞赛全国邀请赛(湖南)
Strange OptimizationBobo is facing a strange optimization problem. Given n,m, he is going to find a real number α such that f(12+α) is maximized, where f(t)=mini,j∈Z|in−jm+t|. Help him!Note: It can be proved that the result is always rational.InputT原创 2017-05-16 12:50:27 · 583 阅读 · 0 评论 -
XTU 1264 Partial Sum 2017年“嘉杰信息杯” 中国大学生程序设计竞赛全国邀请赛(湖南)
Partial SumBobo has a integer sequence a1,a2,…,an of length n. Each time, he selects two ends 0≤l<r≤n and add |∑rj=l+1aj|−C into a counter which is zero initially. He repeats the selection for at most m times.If each end can be selected at most once (e原创 2017-05-16 19:01:51 · 1004 阅读 · 0 评论 -
CSU 1005: Binary Search Tree analog
DescriptionBinary Search Tree, abbreviated as BST, is a kind of binary tree maintains the following property: each node has a Key value, which can be used to compare with each other. For every node in the tree, every Key value in its left subtre原创 2017-04-26 18:16:43 · 384 阅读 · 0 评论 -
CSU 1886: Phone List(2007 Nordic Collegiate Programming Contest)
Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers: Emergency 911 Alice 97 625 999 Bob 91 12 54 26 In this cas原创 2017-04-26 18:41:52 · 384 阅读 · 0 评论 -
CSU 1892: Nested Dolls(2007 Nordic Collegiate Programming Contest)
DescriptionDilworth is the world’s most prominent collector of Russian nested dolls: he literally has thousands of them! You know, the wooden hollow dolls of different sizes of which the smallest doll is contained in the second smallest, and this doll is原创 2017-04-27 09:38:18 · 389 阅读 · 0 评论 -
hiho一下 第158周 非法二进制数
描述如果一个二进制数包含连续的两个1,我们就称这个二进制数是非法的。小Hi想知道在所有 n 位二进制数(一共有2n个)中,非法二进制数有多少个。例如对于 n = 3,有 011, 110, 111 三个非法二进制数。由于结果可能很大,你只需要输出模109+7的余数。输入一个整数 n (1 ≤ n ≤ 100)。输出n 位非法二进制数的数目模109+7的余数。原创 2017-07-09 09:35:16 · 688 阅读 · 0 评论 -
HDU 1009 FatMouse' Trade
Problem DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds of c原创 2017-07-09 09:52:59 · 250 阅读 · 0 评论 -
POJ 3262 Protecting the Flowers (贪心 + 优化)
DescriptionFarmer John went to cut some wood and left N (2 ≤ N ≤ 100,000) cows eating the grass, as usual. When he returned, he found to his horror that the cluster of cows was in his garden eating his beautiful flowers. Wanting to minimize the subsequen原创 2017-07-10 08:48:51 · 342 阅读 · 0 评论 -
CSU 1115 最短的名字(湖南省第八届大学生计算机程序设计竞赛)
Description在一个奇怪的村子中,很多人的名字都很长,比如aaaaa, bbb and abababab。名字这么长,叫全名显然起来很不方便。所以村民之间一般只叫名字的前缀。比如叫'aaaaa'的时候可以只叫'aaa',因为没有第二个人名字的前三个字母是'aaa'。不过你不能叫'a',因为有两个人的名字都以'a'开头。村里的人都很聪明,他们总是用最短的称呼叫人。输入保证村里不会有一个人的名字是另外一个人名字的前缀(作为推论,任意两个人的名字都不会相同)。如果村里的某个人要叫所有人的名字(包括他原创 2017-05-24 16:20:34 · 735 阅读 · 1 评论 -
XTU 1236 Fraction
Problem Description:Everyone has silly periods, especially for RenShengGe. It's a sunny day, no one knows what happened to RenShengGe, RenShengGe says that he wants to change all decimal fractions between 0 and 1 to fraction. In addtion, he says decimal原创 2017-04-22 18:57:12 · 457 阅读 · 0 评论 -
CSU 1111 三家人 (湖南省第八届大学生计算机程序设计竞赛 )
Description有三户人家共拥有一座花园,每户人家的太太均需帮忙整理花园。A 太太工作了5 天,B 太太则工作了4 天,才将花园整理完毕。C 太太因为正身怀六甲无法加入她们的行列,便出了90元。请问这笔钱如何分给A、B 二位太太较为恰当?A 应得多少元?90/(5+4)*5=$50 元?如果这么想你就上当了!正确答案是60 元。如果没想通的话再想想吧。下面回答一个一般性的问题:假定A 太太工作了x 天,B 太太工作了y 天,C 太太出了90元,则A 太太应得多少元?输入保证二位太太均应得到非负整数原创 2017-05-23 14:32:06 · 633 阅读 · 0 评论 -
XTU1225 仙剑奇侠传
题目描述李逍遥被困在镇妖塔内,为了杀出去,免不了需要打赢大Boss。奈何现在等级太低,只能先打打小怪练级了。 李逍遥只能打赢不比自己等级高的怪物。每次战斗都可以获得经验值,经验值是10/(李逍遥等级-怪物等级+1)。 每获得100点经验值,就会升一级。当然,如果遇到打不赢的怪物,那就鞋底抹油,溜之大吉。现在给你李逍遥的初始等级, 依次遇到的怪物级别,问最后李逍遥的级别和经验值(初始的经验值为0)。输入第一行是一个整数T(T ≤ 100),表示样例的个数。 样例的第一行是两个整数N(1≤N≤1000原创 2017-04-18 15:29:27 · 412 阅读 · 0 评论 -
CSU 1030 素数槽
Description 处于相邻的两个素数p和p + n之间的n - 1个连续的合数所组成的序列我们将其称为长度为n的素数槽。例如,‹24, 25, 26, 27, 28›是处于素数23和素数29之间的一个长度为6的素数槽。 你的任务就是写一个程序来计算包含整数k的素数槽的长度。如果k本身就是素数,那么认为包含k的素数槽的长度为0。Input第一行是一个数字n,表示需要测试的数据的个数。后面有n行,每行是一个正整数k, k大于1并且小于或等于的第十万个素数(也就是129原创 2017-04-18 21:27:43 · 450 阅读 · 0 评论 -
XTU 1243 2016 (大数取模+快速幂)
Given a 2×2 matrixA=(a11a21a12a22),find An where A1=A,An=A×An−1. As the result may be large, you are going to find only the remainder after division by 7.Special Note: The problem is intended to be easy. Feel free to think why the problem is called 201原创 2017-04-19 13:06:47 · 746 阅读 · 0 评论 -
XTU 1220 A+B Again
题目描述上次趣味赛小明的a+b坑了不少不喜欢思考的同学,小明为了表示歉意, 这次出了道简单的a+b给大家当签到题,希望大家能开心刷题。 那么,题目来了!!!求使得b/(a+x)为整数的最小正整数x的值。输入第一行是一个整数K(K≤10000),表示样例的个数。 以后每行一个样例,为两个正整数a,b(1≤a,b≤108)。输出每行输出一个样例的结果,如果不存在这样的x,输出-1。原创 2017-04-20 14:10:45 · 420 阅读 · 0 评论 -
XTU 1219 ABK
题目描述ABK是一个比A+B还要简单的题目,给出两个整数A,B,求出A和B的第K大公约数。输入第一行是一个整数N(N ≤ 10000),表示样例的个数。 以后每行一个样例,为3个整数A,B,K (1≤A,B≤109 , 1≤K≤10)输出每行输出一个整数d,表示A,B的第K大公约数 若没有第K大的公约数则输出-1。原创 2017-04-20 14:46:54 · 337 阅读 · 0 评论 -
CSU1004: Xi and Bo (并查集)
DescriptionBo has been in Changsha for four years. However he spends most of his time staying his small dormitory. One day he decides to get out of the dormitory and see the beautiful city. So he asks to Xi to know whether he can get to another bus stati原创 2017-04-17 10:52:46 · 549 阅读 · 0 评论 -
XTU 1249 Rolling Variance
Bobo learnt that the variance of a sequence a1,a2,…,an is∑ni=1(ai−a¯)2n−1−−−−−−−−−−−−√wherea¯=∑ni=1ain.Bobo has a sequence a1,a2,…,an, and he would like to find the variance of each consecutive subsequences of length m. Formally, the i-th (1≤i≤n−m+1)原创 2017-04-20 20:29:26 · 760 阅读 · 0 评论 -
XTU 1250 Super Fast Fourier Transform
Bobo has two sequences of integers {a1,a2,…,an} and {b1,b2,…,bm}. He would like to find∑i=1n∑j=1m⌊|ai−bj|−−−−−−−√⌋.Note that ⌊x⌋ denotes the maximum integer does not exceed x, and |x| denotes the absolute value of x.InputThe input contains at most 30原创 2017-04-21 20:10:31 · 686 阅读 · 0 评论 -
CSU 1112 机器人的指令 (湖南省第八届大学生计算机程序设计竞赛 )
Description数轴原点有一个机器人。该机器人将执行一系列指令,你的任务是预测所有指令执行完毕之后它的位置。·LEFT:往左移动一个单位·RIGHT: 往右移动一个单位·SAME AS i: 和第i 条执行相同的动作。输入保证i 是一个正整数,且不超过之前执行指令数Input输入第一行为数据组数T (T<=100)。每组数据第一行为整数n (1<=n<=100),即指令条数。以下每行一条指令。指令按照输入顺序编号为1~n。Output对于每组数据,输出机器人的最终位置。每处原创 2017-05-23 14:46:42 · 633 阅读 · 0 评论 -
CSU 1113 Updating a Dictionary (湖南省第八届大学生计算机程序设计竞赛)
DescriptionIn this problem, a dictionary is collection of key-value pairs, where keys are lower-case letters, and values are non-negative integers. Given an old dictionary and a new dictionary, find out what were changed.Each dictionary is formatting as原创 2017-05-23 21:07:51 · 718 阅读 · 0 评论 -
CSU 1047 最长上升子序列 (二分水过)
Description 名词解释:一串数字比如1、5、3、6、9、8、10,它的子序列是从左到右不连续的若干个数,比如1、5、6,3、9、8、10都是它的子序列。最长上升子序列即从左到右严格增长的最长的一个子序列,1、5、6、9、10就是这个序列的一个最长上升子序列。给出若干序列,求出每个序列的最长上升子序列长度。Input 多组数据,每组第一行正整数n,1 <= n <= 1000,第二行n个空格隔开的不大于1,000,000的正整数。Output 每组数据输出一行,最长上升原创 2017-08-20 20:27:34 · 442 阅读 · 0 评论