自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 收藏
  • 关注

原创 1079 Total Sales of Supply Chain (25分)

A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Starting from one root supplier, everyone on the...

2020-04-27 21:19:18 120

原创 1090 Highest Price in Supply Chain (25分)

A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Starting from one root supplier, everyone on the...

2020-04-27 21:12:47 161

原创 2018-3-2 碰撞的小球

问题描述   数轴上有一条长度为L(L为偶数)的线段,左端点在原点,右端点在坐标L处。有n个不计体积的小球在线段上,开始时所有的小球都处在偶数坐标上,速度方向向右,速度大小为1单位长度每秒。   当小球到达线段的端点(左端点或右端点)的时候,会立即向相反的方向移动,速度大小仍然为原来大小。   当两个小球撞到一起的时候,两个小球会分别向与自己原来移动的方向相反的方向,以原来的速度大小继续移动。  ...

2020-04-26 14:45:39 144

原创 1053 Path of Equal Weight (30分)

Given a non-empty tree with root R, and with weight W​i​​ assigned to each tree node T​i​​. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path fro...

2020-04-26 09:25:28 128

原创 2016-4-1 折点计数

问题描述   给定n个整数表示一个商店连续n天的销售量。如果某天之前销售量在增长,而后一天销售量减少,则称这一天为折点,反过来如果之前销售量减少而后一天销售量增长,也称这一天为折点。其他的天都不是折点。如下图中,第3天和第6天是折点。 给定n个整数a1, a2, …, an表示销售量,请计算出这些天总共有多少个折点。   为了减少歧义,我们给定的数据保证:在这n天中相邻两天的销售量总是不同的,即a...

2020-04-25 11:49:22 110

原创 1102 Invert a Binary Tree (25分)

The following is from Max Howell @twitter: Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off. Now it’s your turn to pro...

2020-04-25 11:30:48 129

原创 2016-9-1 最大波动

问题描述   小明正在利用股票的波动程度来研究股票。小明拿到了一只股票每天收盘时的价格,他想知道,这只股票连续几天的最大波动值是多少,即在这几天中某天收盘价格与前一天收盘价格之差的绝对值最大是多少。 输入格式   输入的第一行包含了一个整数n,表示小明拿到的收盘价格的连续天数。   第二行包含n个正整数,依次表示每天的收盘价格。 输出格式   输出一个整数,表示这只股票这n天中的最大波动值。 样例...

2020-04-24 12:02:09 102

原创 201612-2工资计算

问题描述   小明的公司每个月给小明发工资,而小明拿到的工资为交完个人所得税之后的工资。假设他一个月的税前工资(扣除五险一金后、未扣税前的工资)为S元,则他应交的个人所得税按如下公式计算:   1) 个人所得税起征点为3500元,若S不超过3500,则不交税,3500元以上的部分才计算个人所得税,令A=S-3500元;   2) A中不超过1500元的部分,税率3%;   3) A中超过1500元...

2020-04-23 12:24:37 142

原创 201612-1 中间数

问题描述   在一个整数序列a1, a2, …, an中,如果存在某个数,大于它的整数数量等于小于它的整数数量,则称其为中间数。在一个序列中,可能存在多个下标不相同的中间数,这些中间数的值是相同的。   给定一个整数序列,请找出这个整数序列的中间数的值。 输入格式   输入的第一行包含了一个整数n,表示整数序列中数的个数。   第二行包含n个正整数,依次表示a1, a2, …, an。 输出格式 ...

2020-04-23 11:52:51 149

原创 1091 Acute Stroke (30分)

One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, your job is to c...

2020-04-17 20:23:43 110

原创 1103 Integer Factorization (30分)

The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program to find the K−P factorization of N for any positive...

2020-04-14 17:47:52 126

原创 1074 Reversing Linked List (25分)

Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K=3, then you must output 3→2→1→6→5→4; if K=4,...

2020-04-11 18:12:38 174

原创 1052 Linked List Sorting (25分)

A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now give...

2020-04-09 21:16:57 120

原创 2019-12-2 回收站选址

思路:起初想用多重map做题,但之前也一直没有了解过,就只好使用pair来解题 题目逻辑还是很明确的,重点是map的使用以及pair的使用,只要清楚直到,解题还是很简单的 AC #include<stdio.h> #include<map> using namespace std; map<pair<int,int>,int>mp;//pair的用法...

2020-04-08 21:36:15 119

原创 1056 Mice and Rice (25分)

Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice...

2020-04-07 19:15:57 141

原创 1051 Pop Sequence (25分)

Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the...

2020-04-06 21:33:57 436

原创 2019-3-2 二十四点

题意:在不大于10以内的加减乘除运算,看他们是否等于24 思路:这道题主要需要注意的是运算符优先级的考虑,这里我们使用map<char,int>来体现运算符的优先级;而算数运算则通过中缀表达式转换后缀表达式,利用栈和对列来进行操作; stack用来存储操作符:如果当前操作符比栈顶操作法优先级高,则将它压入栈中,若果小于等于栈顶操作符优先级,则将栈顶的操作符压入队列中 queue用来存储...

2020-04-06 11:29:47 143

原创 1022 Digital Library (30分)

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a...

2020-04-01 16:49:20 99

原创 1071 Speech Patterns (25分)

People often have a preference among synonyms of the same word. For example, some may prefer “the police”, while others may prefer “the cops”. Analyzing such patterns can help to narrow down a speaker...

2020-04-01 11:39:47 162

原创 1054 The Dominant Color (20分)

Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the d...

2020-04-01 11:32:30 109

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除