11 2018 档案
摘要:我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。 Input输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0<n<=10
阅读全文
摘要:Cure Given an integer nn, we only want to know the sum of 1/k21/k2 where kk from 11 to nn. Input There are multiple cases. For each test case, there i
阅读全文
摘要:欧拉回路 欧拉回路是指不令笔离开纸面,可画过图中每条边仅一次,且可以回到起点的一条回路。现给定一个图,问是否存在欧拉回路? Input 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是节点数N ( 1 < N < 1000 )和边数M;随后的M行对应M条边,每行给出一对正整数,分
阅读全文
摘要:Little Boxes Little boxes on the hillside. Little boxes made of ticky-tacky. Little boxes. Little boxes. Little boxes all the same. There are a green
阅读全文
摘要:Give Me the Number Numbers in English are written down in the following way (only numbers less than 109are considered). Number abc,def,ghi is written
阅读全文
摘要:Choose the best route One day , Kiki wants to visit one of her friends. As she is liable to carsickness , she wants to arrive at her friend’s home as
阅读全文
摘要:大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了! 做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样。 话虽这样说,我还是要告诉大家,要想失败到一定程度也是不容易的。比如,我高中的时候,就有一个神奇的女生,在英语考试的时候,竟然把
阅读全文
摘要:Eddy's AC难题 Eddy是个ACMer,他不仅喜欢做ACM题,而且对于Ranklist中每个人的ac数量也有一定的研究,他在无聊时经常在纸上把Ranklist上每个人的ac题目的数量摘录下来,然后从中选择一部分人(或者全部)按照ac的数量分成两组进行比较,他想使第一组中的最小ac数大于第二组
阅读全文
摘要:M斐波那契数列 M斐波那契数列F[n]是一种整数数列,它的定义如下: F[0] = a F[1] = b F[n] = F[n-1] * F[n-2] ( n > 1 ) 现在给出a, b, n,你能求出F[n]的值吗? Input 输入包含多组测试数据; 每组数据占一行,包含3个整数a, b, n
阅读全文
摘要:Jzzhu and Sequences Jzzhu has invented a kind of sequences, they meet the following property: You are given x and y, please calculate fn modulo 100000
阅读全文
摘要:Revenge of GCD In mathematics, the greatest common divisor (gcd), also known as the greatest common factor (gcf), highest common factor (hcf), or grea
阅读全文
摘要:本原串 由0和1组成的串中,不能表示为由几个相同的较小的串连接成的串,称为本原串,有多少个长为n(n<=100000000)的本原串? 答案mod2008. 例如,100100不是本原串,因为他是由两个100组成,而1101是本原串。 Input 本原串 由0和1组成的串中,不能表示为由几个相同的较
阅读全文
摘要:Large Division Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer
阅读全文
摘要:旅行comf 给你一个无向图,N(N<=500)个顶点, M(M<=5000)条边,每条边有一个权值Vi(Vi<30000)。给你两个顶点S和T,求一条路径,使得路径上最大边和最小边的比值最小。如果S和T之间没有路径,输出”IMPOSSIBLE”,否则输出这个比值,如果需要,表示成一个既约分数。 备
阅读全文
摘要:Destroy Walls Long times ago, there are beautiful historic walls in the city. These walls divide the city into many parts of area. Since it was not co
阅读全文
摘要:find the safest road find the safest road XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s
阅读全文
摘要:Constructing Roads There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to e
阅读全文
摘要:Dividing Marsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the ma
阅读全文
摘要:FATE 最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐
阅读全文
摘要:Robberies The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because the
阅读全文
摘要:1040 Longest Symmetric String (25 分) Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is
阅读全文
摘要:Cash Machine A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. Th
阅读全文
摘要:Bone Collector Bone Collector Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of
阅读全文
摘要:Common Subsequence A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2,
阅读全文
摘要:悼念512汶川大地震遇难同胞 急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。 请问:你用有限的资金最多能采购多少公斤粮食呢? 后记: 人生是一个充满了变数
阅读全文
摘要:Super Jumping! Jumping! Jumping! Super Jumping! Jumping! Jumping! Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very pop
阅读全文
摘要:Binary Tree Traversals A binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the
阅读全文
摘要:Fence Repair Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,0
阅读全文
摘要:Root of AVL Tree An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at mo
阅读全文