ACM
文章平均质量分 60
liudy95
这个作者很懒,什么都没留下…
展开
-
120. 三角形最小路径和
给定一个三角形 triangle ,找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。相邻的结点 在这里指的是 下标 与 上一层结点下标 相同或者等于 上一层结点下标 + 1 的两个结点。也就是说,如果正位于当前行的下标 i ,那么下一步可以移动到下一行的下标 i 或 i + 1 。示例 1:输入:triangle = [[2],[3,4],[6,5,7],[4,1,8,3]]输出:11解释:如下面简图所示: 2 3 4 6 5 74 1 8 3自顶向下的最小路径和原创 2021-03-13 13:51:51 · 150 阅读 · 0 评论 -
24点游戏
题目描述给出4个1-10的数字,通过加减乘除,得到数字为24就算胜利输入:4个1-10的数字。[数字允许重复,但每个数字仅允许使用一次,测试用例保证无异常数字]输出:true or false输入描述:输入4个int整数输出描述:返回能否得到24点,能输出true,不能输出false示例1输入7 2 1 10输出true解题代码:#include <ios...原创 2019-05-12 08:28:50 · 342 阅读 · 0 评论 -
uva 10129 - Play on Words
Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very imp原创 2018-01-23 20:31:49 · 189 阅读 · 0 评论 -
PAT 1002. Business (35)
As the manager of your company, you have to carefully consider, for each project, the time taken to finish it, the deadline, and the profit you can gain, in order to decide if your group should take th原创 2017-10-16 23:04:22 · 474 阅读 · 0 评论 -
PAT 1001. Battle Over Cities - Hard Version (35)
It is vitally important to have all the cities connected by highways in a war. If a city is conquered by the enemy, all the highways from/toward that city will be closed. To keep the rest of the cities原创 2017-10-14 22:10:02 · 484 阅读 · 0 评论 -
uva 900 - Brick Wall Patterns
#include<iostream>using namespace std;int M[26][51]; //行代表右2的个数,列代表有几个数,矩阵值代表当前情况所有的个数。例如 M[1][5] = 4 代表有5球将相邻的两个求合并在一起有4种情况, M[2][5] = 3 代表有5个球将两个两两相邻的求合并在一起有3种情况。//与题中对应就是:列代表题中所需长度L,两个球合并代表一个砖块倒着放原创 2017-10-12 22:33:01 · 305 阅读 · 0 评论 -
PAT 1004. To Buy or Not to Buy - Hard Version (35)
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原创 2017-10-21 23:20:31 · 351 阅读 · 0 评论 -
PAT 1003. Universal Travel Sites (35)
After finishing her tour around the Earth, CYLL is now planning a universal travel sites development project. After a careful investigation, she has a list of capacities of all the satellite transporta原创 2017-10-21 14:37:24 · 2639 阅读 · 0 评论 -
ACM 解题处理思路
输入一些单词,找出其中不能通过字母重排,得到文本另一个单词。 处理方法: 将单词标准化,即对每个单词进行字母排序 string repr(const string &s){ string ans = s; for(int i = 0; i < ans.length(); i++){ ans[i] = tolower(ans[i]); }原创 2017-09-01 10:42:21 · 555 阅读 · 0 评论 -
1003. Emergency (25)
#include <iostream>using namespace std;#define Max 999999999int dis[501][501];int team[501];struct City{ int step, teams; City(){ step = Max; teams = 0; }};City city[500];int min_原创 2017-06-14 23:35:19 · 267 阅读 · 0 评论 -
1010. Radix (25)
1010. Radix (25)Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is “yes”, if 6 is a decimal number and 110 is a binary number.Now for any pair o原创 2017-06-25 12:54:50 · 335 阅读 · 0 评论 -
1009. Product of Polynomials (25)
1009. Product of Polynomials (25)This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and ea原创 2017-06-16 17:09:24 · 331 阅读 · 0 评论 -
1008. Elevator (20)
1008. Elevator (20)The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified ord原创 2017-06-16 16:30:24 · 231 阅读 · 0 评论 -
1007. Maximum Subsequence Sum (25)
1007. Maximum Subsequence Sum (25)Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, Ni+1, …, Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the原创 2017-06-16 13:58:41 · 248 阅读 · 0 评论 -
1006. Sign In and Sign Out (25)
1006. Sign In and Sign Out (25)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records原创 2017-06-16 11:04:03 · 333 阅读 · 0 评论 -
1005. Spell It Right (20)
1005. Spell It Right (20)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contain原创 2017-06-16 10:22:29 · 230 阅读 · 0 评论 -
1004. Counting Leaves (30)
1004. Counting Leaves (30)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each case原创 2017-06-15 21:27:41 · 240 阅读 · 0 评论 -
1075 Thread in a space
1075 Thread in a space原创 2016-08-09 12:18:35 · 795 阅读 · 1 评论 -
1095 Nikifor3
1095 Nikifor3原创 2016-08-10 15:18:21 · 323 阅读 · 0 评论