OJ
OJ
Jitwxs
关注 https://jitwxs.cn,看最新首发文章
展开
-
POJ 3617 Best Cow Line【贪心】
DescriptionFJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual”Farmer of the Year” competition. In this contest every farmer arranges his cows in a line and herds them past the judges.The...原创 2017-11-29 23:03:00 · 259 阅读 · 0 评论 -
OJ中使用Java语言的代码优化策略
前言:因为Java语言的运行缓慢,因此在OJ中Java需要使用比C/C++更多的运行时间和运行内存,但是依然比较容易超时,因此在oj中几乎没有人使用Java来作为编程语言。但是,如果你执着于使用Java语言,不妨记住以下的优化册罗。1. 替换输入不要使用Scanner作为输入方式,使用BufferedReader作为替换,并在结束输入后尽早将其close()掉。BufferedReader br =原创 2017-08-24 11:01:09 · 653 阅读 · 1 评论 -
POJ 1163 The Triangle
Description73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the t原创 2017-08-19 11:34:38 · 218 阅读 · 0 评论 -
POJ 3069 Saruman's Army 【贪心】
DescriptionSaruman the White must lead his army along a straight path from Isengard to Helm’s Deep. To keep track of his forces, Saruman distributes seeing stones, known as palantirs, among the troo...原创 2017-04-11 18:19:09 · 315 阅读 · 0 评论 -
HDU 2037 今年暑假不AC
Problem Description“今年暑假不AC?” “是的。” “那你干什么呢?” “看世界杯呀,笨蛋!” “@#$%^&*%…”确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视了。 作为球迷,一定想看尽量多的完整的比赛,当然,作为新时代的好青年,你一定还会看一些其它的节目,比如新闻联播(永远不要忘记关心国家大事)、非常6+7、超级女生,以及王小丫的原创 2019-11-18 10:01:08 · 429 阅读 · 0 评论 -
2016 蓝桥杯 预选赛
通往图书馆的楼梯塞不下的背包通往图书馆的楼梯【问题描述】Mr. Chen 决定去图书馆复习,上图书馆需要爬好多级台阶。Mr. Chen 可以一步跨两级,也可以一级一级走。他突然想到一个问题,对于这段共 N 级的楼梯,若每次只能跨一级或二级,要走上第 N 级,共有多少种走法?【输入格式】输入共 N+1 行,第一行为一个整数 T,表示共有 T 组数...原创 2017-04-12 14:06:20 · 561 阅读 · 0 评论 -
2014 蓝桥杯 JavaB组 省赛
1. 武功秘籍2. 切面条3. 猜字母4. 大衍数列5. 圆周率6. 奇怪的分式7. 扑克序列8. 分糖果9. 地宫取宝10. 矩阵翻硬币1. 武功秘籍小明到X山洞探险,捡到一本有破损的武功秘籍(2000多页!当然是伪造的)。他注意到:书的第10页和第11页在同一张纸上,但第11页和第12页不在同一张纸上。小明只想练习该书的第81页到...原创 2017-04-06 23:27:43 · 671 阅读 · 0 评论 -
2017 蓝桥杯 JavaB组 省赛
2018年4月1日,备战2018蓝桥杯省赛! 转载请注明出处https://blog.csdn.net/yuanlaijike/article/details/698024311. 购物单2. 纸牌三角形3. 承压计算4. 魔方状态5. 取数位6. 最大公共子串7. 日期问题8. 包子凑数9. 分巧克力10. k倍区间1. 购物...原创 2017-04-09 10:04:00 · 2296 阅读 · 3 评论 -
2015 蓝桥杯 JavaB组 省赛
1. 三角形面积2. 立方变自身3. 三羊献瑞4. 循环节5. 九数组分数6. 加法变乘法7. 牌型种数8. 饮料换购9. 垒骰子10. 生命之树1. 三角形面积图中的所有小方格面积都是1。 那么,图中的三角形面积应该是多少呢?请填写三角形的面积。不要填写任何多余内容或说明性文字。博主有话说 可以直接确定3条边的边长,...原创 2017-04-05 14:27:36 · 821 阅读 · 0 评论 -
2016 蓝桥杯 JavaB组 省赛
2018年4月1日,备战2018蓝桥杯省赛! 转载请注明出处https://blog.csdn.net/yuanlaijike/article/details/692304981. 煤球数目2. 生日蜡烛3. 算式4. 分小组5. 抽签6. 方格填数7. 剪邮票8. 四平方和9. 取球博弈10. 压缩变换1. 煤球数目有一...原创 2017-04-05 11:58:34 · 2021 阅读 · 0 评论 -
2017 蓝桥杯 模拟赛
1. 算年龄2. 猜算式3. 排列序数4. 字符串比较5. 报数游戏6. 滑动解锁7. 奇怪的捐赠1. 算年龄英国数学家德摩根出生于19世纪初叶(即18xx年)。 他年少时便很有才华。一次有人问他的年龄,他回答说: “到了x的平方那年,我刚好是x岁”。请你计算一下,德摩根到底出生在哪一年。 题中的年龄指的是周岁。请填写表示他出生年份的四位数字...原创 2018-03-25 15:42:48 · 1412 阅读 · 0 评论 -
HDU 1016 Prime Ring Problem
Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.N...原创 2018-03-25 14:46:09 · 222 阅读 · 0 评论 -
PAT 试题集【JAVA版】
1008 数组元素循环右移问题1009 说反话1010 一元多项式求导1013 数素数1021 各位数统计1031 查验身份证1036 和奥巴马一起编程1041 考试座位号1046 划拳1067 试密码1008 数组元素循环右移问题Problem: 一个数组A中存有N(N>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移...原创 2017-08-17 20:48:38 · 2016 阅读 · 2 评论 -
HDU 1021 Fibonacci Again
Problem DescriptionThere 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,0原创 2017-08-17 20:31:27 · 192 阅读 · 0 评论 -
POJ 1005 I Think I Need a Houseboat
I Think I Need a HouseboatTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 103105 Accepted: 44854DescriptionFred Mapper is considering purchasing some原创 2017-03-17 16:45:38 · 263 阅读 · 0 评论 -
POJ 1852 Ants
AntsTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 17207 Accepted: 7344DescriptionAn army of ants walk on a horizontal pole of length l cm, each with a原创 2017-03-17 15:05:34 · 343 阅读 · 0 评论 -
POJ 1006 Biorhythms
BiorhythmsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 134867 Accepted: 43090DescriptionSome people believe that there are three cycles in a person原创 2017-03-17 17:26:08 · 290 阅读 · 0 评论 -
POJ 1007 DNA Sorting
DNA SortingDescriptionOne measure of ”unsortedness” in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence ”DAABEC”, thi原创 2017-04-11 19:06:00 · 246 阅读 · 0 评论 -
POJ 2386 Lake Counting【DFS】
Lake CountingDescription Due to recent rains, water has pooled in various places in Farmer John’s field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squa...原创 2017-04-11 18:22:20 · 307 阅读 · 0 评论 -
HDU 1003 Max Sum
Max SumProblem DescriptionGiven a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 +原创 2017-04-11 19:02:02 · 300 阅读 · 0 评论 -
POJ 1004 Financial Management
Financial ManagementTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 182563 Accepted: 68949DescriptionLarry graduated this year and finally has a job.原创 2017-03-17 16:10:19 · 331 阅读 · 0 评论 -
POJ 1003 Hangover
HangoverTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 124095 Accepted: 60548DescriptionHow far can you make a stack of cards overhang a table? If you原创 2017-03-17 15:57:40 · 259 阅读 · 0 评论 -
HDU 1061 Rightmost Digit
Problem:Given a positive integer N, you should output the most right digit of N^N.Input:The input contains several test cases. The first line of the input is a single integer T which is the number of t原创 2017-08-17 20:17:59 · 352 阅读 · 0 评论 -
LQOJ ALGO-156 表达式计算
表达式计算问题描述输入一个只包含加减乖除和括号的合法表达式,求表达式的值。其中除表示整除。输入格式 输入一行,包含一个表达式。输出格式输出这个表达式的值。样例输入 1-2+3*(4-5)样例输出 -4数据规模和约定表达式长度不超过100,表达式运算合法且运算过程都在int内进行。解题代码import java.util.*;public class Main { pub原创 2017-04-12 23:31:31 · 458 阅读 · 0 评论 -
2017 金科校春季赛 神奇的幻方
神奇的幻方【问题描述】幻方是一种很神奇的 N ∗ N 矩阵:它由数字 1,2,3, … … , N ∗ N 构成,且每行、每列及两条对角线上的数字之和都相同。当 N 为奇数时,我们可以通过以下方法构建一个幻方: 首先将 1 写在第一行的中间。 之后,按如下方式从小到大依次填写每个数 K(K = 2,3, … , N ∗ N) :若 (K − 1) 在第一行但不在最后一列,则将 K 填在最后一行原创 2017-04-12 23:15:54 · 304 阅读 · 0 评论 -
HDU 2602 Bone Collector【01背包】
Problem DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave ...原创 2017-04-11 21:56:58 · 287 阅读 · 0 评论 -
HDU 2546 饭卡
饭卡Problem Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。 某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。Input多组数据。对于原创 2017-04-11 22:47:22 · 315 阅读 · 0 评论