贺巩山的博客

没有伞的孩子更要努力奔跑


  • 首页

  • 文件系统

  • Linux运维

  • 剑指Offer

  • LeetCode题解

  • PAT甲级题解

  • PAT乙级题解

  • CCF CSP题解

  • 分类

  • 标签

  • 归档

  • 书单

  • 关于

  • 搜索

PAT甲级 1012.The Best Rank (25 分)

发表于 2019-06-20 | 更新于 2019-06-20 | 分类于 pat甲级
字数统计: 836

To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - English. At the mean time, we encourage students by emphasizing on their best ranks – that is, among the four ranks with respect to the three courses and the average grade, we print the best rank for each student.

For example, The grades of C, M, E and A - Average of 4 students are given as the following:

1
2
3
4
5
StudentID  C  M  E  A
310101 98 85 88 90
310102 70 95 88 84
310103 82 87 94 88
310104 91 91 91 91

Then the best ranks for all the students are No.1 since the 1st one has done the best in C Programming Language, while the 2nd one in Mathematics, the 3rd one in English, and the last one in average.

阅读全文 »

关于《流浪地球》这篇小说

发表于 2019-06-17 | 更新于 2019-06-19 | 分类于 读书笔记
字数统计: 1.2k

The Wandering Earth

《流浪地球》是一篇精彩宏大的小说,这里记录下小说中的一些设定及情节。

阅读全文 »

2019年“锐捷网络杯”华中区高校研究生程序设计大赛K.A good game

发表于 2019-06-02 | 更新于 2019-06-02 | 分类于 程序设计
字数统计: 616

Bigbrother is a cute boy who likes to play cards. One day, he gets N cards and every of them has a number $V_i$. Now, he wants to play a game with you.

He has M operations.

In the k-th operation, the sum of $V_i$ between intervals [L,R] is S, k×S is the k-th score.

You can sort the M operations and get the maximum sum of scores.

阅读全文 »

LeetCode 946.验证栈序列/《剑指Offer》31.栈的压入、弹出序列

发表于 2019-06-01 | 更新于 2020-03-02 | 分类于 leetcode
字数统计: 524

给定 pushed 和 popped 两个序列,只有当它们可能是在最初空栈上进行的推入 push 和弹出 pop 操作序列的结果时,返回 true;否则,返回 false 。

阅读全文 »

关于研会竞选这件事

发表于 2019-05-30 | 更新于 2019-06-03 | 分类于 生活
字数统计: 849

2019年5月30日,武汉大学计算机学院举办了第十九届研究生代表大会,我成为了计算机学院第十九届研究生会主席团的一名成员。

阅读全文 »

PAT乙级 1015.德才论/PAT甲级 1062.Talent and Virtue (25 分)

发表于 2019-05-29 | 更新于 2019-05-30 | 分类于 pat乙级 , pat甲级
字数统计: 968

宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”:“是故才德全尽谓之圣人,才德兼亡谓之愚人,德胜才谓之君子,才胜德谓之小人。凡取人之术,苟不得圣人,君子而与之,与其得小人,不若得愚人。”

现给出一批考生的德才分数,请根据司马光的理论给出录取排名。

阅读全文 »

LeetCode 889.根据前序和后序遍历构造二叉树

发表于 2019-05-29 | 更新于 2019-05-30 | 分类于 leetcode
字数统计: 411

返回与给定的前序和后序遍历匹配的任何二叉树。

阅读全文 »

LeetCode 106.从中序与后序遍历序列构造二叉树

发表于 2019-05-29 | 更新于 2019-05-30 | 分类于 leetcode
字数统计: 402

根据一棵树的中序遍历与后序遍历构造二叉树。

阅读全文 »

LeetCode 105.从前序与中序遍历序列构造二叉树/《剑指Offer》7.重建二叉树

发表于 2019-05-29 | 更新于 2020-02-21 | 分类于 leetcode
字数统计: 406

根据一棵树的前序遍历与中序遍历构造二叉树。

阅读全文 »

LeetCode 1008.先序遍历构造二叉树

发表于 2019-05-27 | 更新于 2019-05-28 | 分类于 leetcode
字数统计: 509

返回与给定先序遍历 preorder 相匹配的二叉搜索树(binary search tree)的根结点。

(回想一下,二叉搜索树是二叉树的一种,其每个节点都满足以下规则,对于 node.left 的任何后代,值总 < node.val,而 node.right 的任何后代,值总 > node.val。此外,先序遍历首先显示节点的值,然后遍历 node.left,接着遍历 node.right。)

阅读全文 »
1…353637…49
Gongshan He

Gongshan He

490 日志
62 分类
89 标签
GitHub 微博 知乎 Linkedin E-Mail
友情链接
  • 卢明冬的博客
  • lipixun
  • 柳婼 の blog
  • 心灵港
  • Liudeyin
© 2016 — 2023 Gongshan He
访问人数 总访问量 次