- 博客(9)
- 收藏
- 关注
原创 (稀疏矩阵)1090 Highest Price in Supply Chain (25分)
1090Highest 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 chain buys p..
2020-11-30 12:49:38
123
原创 (map构建链表,一次AC)1074 Reversing Linked List (25分)
1074Reversing Linked List(25分)Given a constantKand a singly linked listL, you are supposed to reverse the links of everyKelements onL. For example, givenLbeing 1→2→3→4→5→6, ifK=3, then you must output 3→2→1→6→5→4; ifK=4, you must output 4→3→2...
2020-11-21 11:29:41
154
原创 (用好指针,树的问题简简单单)1102 Invert a Binary Tree (25分)
关键点就是找到根节点,因此定义的结构体有个指向父节点的指针,最后只有一个节点的父节点指针为null,即是根节点,然后遍历。反转遍历只需左右颠倒就行1102Invert 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...
2020-11-19 10:24:09
129
原创 (用指针造出这棵树,层序遍历)1004 Counting Leaves (30分)
1004Counting Leaves(30分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains one test case. Each case starts with a line containing0<...
2020-11-17 19:23:42
158
1
原创 1030 Travel Plan (30分)(俺是个粗人)
就保存所有的路径,找出最短最便宜的叭#include<iostream>#include<vector>#include<limits.h>using namespace std;struct node{ int distance; int cost;};int num,roads,c,des;node map[501][501];bool vis[501] = {false};vector<vector<int&g...
2020-11-17 17:42:10
171
1
原创 1081 Rational Sum (20分)(代码简单明了,最小公约数和最大公倍数)
1081Rational Sum(20分)GivenNrational numbers in the formnumerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive integerN(≤100), followed in the ...
2020-11-16 20:16:21
126
原创 1036 Boys vs Girls (25分)(就挺 easy 的)
1036Boys vs Girls(25分)This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one test case. Each case contains a..
2020-11-16 15:03:58
149
原创 1020 Tree Traversals (25分)(依次二分先序数组,递归构造左右子树)
1020Tree Traversals(25分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the corresponding binary tree.Inp..
2020-11-16 14:38:26
151
原创 1092 To Buy or Not to Buy (20分)(简单利用string.h的find,一次遍历)
1092To Buy or Not to Buy(20分)Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sell the strings in whole ..
2020-11-16 08:49:02
126
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人