Blankj's Blog

select * from learn


  • 首页

  • 关于

  • 分类

  • 标签

  • 归档

  • GitBook

  • 小伙伴们

  • 搜索

Java对结构体的排序

发表于 2015-04-01 | 分类于 OJ

题目描述

输入若干个学生的信息(学号、姓名、成绩),输入学号为0时结束,用单向链表组织这些学生的信息后,再按成绩由低到高顺序输出。

阅读全文 »

Blocks

发表于 2015-03-24 | 分类于 OJ

Description

Donald wishes to send a gift to his new nephew, Fooey. Donald is a bit of a traditionalist, so he has chosen to send a set of N classic baby blocks. Each block is a cube, 1 inch by 1 inch by 1 inch. Donald wants to stack the blocks together into a rectangular solid and wrap them all up in brown paper for shipping. How much brown paper does Donald need?

阅读全文 »

Hay Points

发表于 2015-03-24 | 分类于 OJ

Description

Each employee of a bureaucracy has a job description - a few paragraphs that describe the responsibilities of the job. The employee’s job description, combined with other factors, such as seniority, is used to determine his or her salary.

The Hay Point system frees the Human Resources department from having to make an intelligent judgement as to the value of the employee; the job description is merely scanned for words and phrases that indicate responsibility. In particular, job descriptions that indicate control over a large budget or management over a large number of people yield high Hay Point scores.

You are to implement a simplified Hay Point system. You will be given a Hay Point dictionary and a number of job descriptions. For each job description you are to compute the salary associated with the job, according to the system.

阅读全文 »

YY's Minions

发表于 2015-03-22 | 分类于 OJ

Despite YY’s so much homework, she would like to take some time to play with her minions first.

YY lines her minions up to an N*M matrix. Every minion has two statuses: awake or asleep. We use 0(the digit) to represent that it is asleep, and 1 for awake. Also, we define the minions who are around a minion closest in one of the eight directions its neighbors. And every minute every minion will change its status by the following specific rules:
If this minion is awake, and the number of its neighbors who are awake is less than 2, this minion will feel lonely and turn to asleep.
If this minion is awake, and the number of its neighbors who are awake is more than 3, this minion will turn to asleep for it will feel too crowded.
If this minion is awake, and the number of its neighbors who are awake is exactly 2 or 3, this minion will keep being awake and feel very happy.
If this minion is asleep, and the number of its neighbors who are awake is exactly 3, this minion will wake up because of the noise.
Note that all changes take place at the same time at the beginning of a specific minute.
Also, some minions will get bored and leave this silly game. We use ‘X’s to describe them. We suppose that a minion would leave after T minutes. It will leave at the end of the Tth minute. Its status is considered during the change at the beginning of the Tth minute, and should be ignored after that. Of course, one minion will not leave twice!

YY is a girl full of curiosity and wants to know every minion’s status after F minutes. But you know she is weak and lazy! Please help this cute girl to solve this problem :)

阅读全文 »

等差数列

发表于 2015-03-22 | 分类于 OJ

题目描述

给定n(1<=n<=400)个数,从中找出尽可能多的数使得他们能够组成一个等差数列.求最长的等差数列的长度.

阅读全文 »

Maze Problem

发表于 2015-02-12 | 分类于 OJ

题目描述

Given a maze, find a shortest path from start to goal.

阅读全文 »

Tri Tiling

发表于 2015-01-26 | 分类于 OJ

In how many ways can you tile a 3xn rectangle with 2x1 dominoes?

Here is a sample tiling of a 3x12 rectangle.

tri-tiling.jpg
阅读全文 »

Tug of War

发表于 2015-01-18 | 分类于 OJ

题目描述

A tug of war is to be arranged at the local office picnic. For the tug of war, the picnickers must be divided into two teams. Each person must be on one team or the other; the number of people on the two teams must not differ by more than 1; the total weight of the people on each team should be as nearly equal as possible.

The first line of input contains n the number of people at the picnic. n lines follow. The first line gives the weight of person 1; the second the weight of person 2; and so on. Each weight is an integer between 1 and 450. There are at most 100 people at the picnic.

Your output will be a single line containing 2 numbers: the total weight of the people on one team, and the total weight of the people on the other team. If these numbers differ, give the lesser first.

阅读全文 »

A sequence of numbers(快速求幂)

发表于 2015-01-12 | 分类于 OJ

题目描述

Xinlv wrote some sequences on the paper a long time ago, they might be arithmetic or geometric sequences. The numbers are not very clear now, and only the first three numbers of each sequence are recognizable. Xinlv wants to know some numbers in these sequences, and he needs your help.

阅读全文 »

Additive equations

发表于 2015-01-04 | 分类于 OJ

题目描述

We all understand that an integer set is a collection of distinct integers. Now the question is: given an integer set, can you find all its addtive equations? To explain what an additive equation is, let’s look at the following examples:
1+2=3 is an additive equation of the set {1,2,3}, since all the numbers that are summed up in the left-hand-side of the equation, namely 1 and 2, belong to the same set as their sum 3 does. We consider 1+2=3 and 2+1=3 the same equation, and will always output the numbers on the left-hand-side of the equation in ascending order. Therefore in this example, it is claimed that the set {1,2,3} has an unique additive equation 1+2=3.
It is not guaranteed that any integer set has its only additive equation. For example, the set {1,2,5} has no addtive equation and the set {1,2,3,5,6} has more than one additive equations such as 1+2=3, 1+2+3=6, etc. When the number of integers in a set gets large, it will eventually become impossible to find all the additive equations from the top of our minds – unless you are John von Neumann maybe. So we need you to program the computer to solve this problem.

阅读全文 »
1…1314
布兰柯基

布兰柯基

140 日志
32 分类
63 标签
GitHub 简书 掘金 CSDN 微博
0%
© 2018 布兰柯基