ACM-ICPC
Viatorz
no pain,no gain
展开
-
UVA - 10815 Andy's First Dictionary
题目链接https://vjudge.net/problem/UVA-10815#author=thestyx Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is,...原创 2019-03-16 16:54:49 · 92 阅读 · 0 评论 -
树状数组
首先树状数组是一种用于维护前缀信息的的数据结构,其实现十分简洁优美,如下图。 一般来说,树状数组可以解决的问题线段树也可以,但是树状数组的常数会更小。 C1 = A1 C2 = A1 + A2 C3 = A3 C4 = A1 + A2 + A3 + A4 C5 = A5 C6 = A5 + A6 C7 = A7 C8 = A1 + A2 + A3 + A4 + A5 + A6...原创 2019-05-05 17:49:42 · 188 阅读 · 0 评论 -
POJ - 1163 The Triangle (动态规划)
题目链接https://vjudge.net/problem/POJ-1163 题目 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbe...原创 2019-05-08 18:05:57 · 119 阅读 · 0 评论 -
OpenJ_Bailian - 2757 最长上升子序列 (动态规划)
题目链接http://bailian.openjudge.cn/practice/2757?lang=en_US 题目 描述 一个数的序列bi,当b1<b2< ... <bS的时候,我们称这个序列是上升的。对于给定的一个序列(a1,a2, ...,aN),我们可以得到一些上升的子序列(ai1,ai2, ...,aiK),这里1 <=i1<...原创 2019-05-08 18:53:48 · 126 阅读 · 0 评论 -
POJ - 1458 Common Subsequence(最长公共子序列,动态规划)
题目链接https://vjudge.net/problem/POJ-1458 题目 A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > anothe...原创 2019-05-08 20:58:01 · 233 阅读 · 0 评论 -
OpenJ_Bailian - 2755 神奇的口袋 (动态规划)
题目链接https://vjudge.net/problem/OpenJ_Bailian-2755 题目 有一个神奇的口袋,总的容积是40,用这个口袋可以变出一些物品,这些物品的总体积必须是40。John现在有n个想要得到的物品,每个物品的体积分别是a1,a2……an。John可以从这些物品中选择一些,如果选出的物体的总体积是40,那么利用这个神奇的口袋,John就可以得到这些物品。现...原创 2019-05-09 21:58:14 · 118 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(西安赛区)网络赛C. Sum
题目 Define the function S(x) for xx is a positive integer. S(x) equals to the sum of all digit of the decimal expression of x. Please find a positive integer k that S(k∗x)%233=0. Input Format Fir...原创 2019-05-19 21:29:32 · 267 阅读 · 0 评论 -
POJ - 3624 Charm Bracelet (0-1背包)
题目链接https://vjudge.net/problem/POJ-3624 题目 Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from theN(1 ≤N≤...原创 2019-05-10 12:16:25 · 97 阅读 · 0 评论 -
POJ - 1195 Mobile phones (二维树状数组)
题目链接http://poj.org/problem?id=1195 题目 Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an ...原创 2019-05-07 17:44:06 · 106 阅读 · 0 评论 -
POJ - 1094 Sorting It All Out (拓扑排序)
题目链接http://poj.org/problem?id=1094 题目 An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. Fo...原创 2019-04-28 18:30:27 · 123 阅读 · 0 评论 -
HDU - 6182 A Math Problem (打表)
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=6182 题目 You are given a positive integer n, please count how many positive integers k satisfykk≤nkk≤n. Input There are no more than 50 test cases....原创 2019-04-16 17:06:33 · 251 阅读 · 0 评论 -
HDU - 6188 Duizi and Shunzi (贪心)
题目链接https://vjudge.net/problem/HDU-6188 题目 Nike likes playing cards and makes a problem of it. Now give you n integers,ai(1≤i≤n)ai(1≤i≤n) We define two identical numbers (eg:2,22,2) a Duizi, a...原创 2019-04-16 15:51:27 · 116 阅读 · 0 评论 -
UVA - 136 Ugly Numbers
题目链接https://vjudge.net/problem/UVA-136 题意 丑数是指不能被2,3,5以外的其他素数整除的数。把丑数从小到大排列起来,结果如下: 1,2,3,4,5,6,8,9,10,12,15…… 求第1500个丑数 输入 没有输入 输出 The 1500'th ugly number is <number>. 思路 最小的丑数是1,对于...原创 2019-03-21 11:46:48 · 259 阅读 · 0 评论 -
UVA - 514 Rails (栈混洗,贪心)
题目链接https://vjudge.net/problem/UVA-514#author=0 这个题就是栈混洗第三种甄别方法,利用的是贪心的思想 AC代码 #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm...原创 2019-03-16 23:43:28 · 504 阅读 · 0 评论 -
POJ - 2386 Lake Counting
题目链接http://poj.org/problem?id=2386 题目 Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M &l...原创 2019-03-22 19:36:58 · 114 阅读 · 0 评论 -
OpenJ_Bailian - 3752 走迷宫 (BFS)
题目链接http://bailian.openjudge.cn/practice/3752?lang=en_US 题目 一个迷宫由R行C列格子组成,有的格子里有障碍物,不能走;有的格子是空地,可以走。 给定一个迷宫,求从左上角走到右下角最少需要走多少步(数据保证一定能走到)。只能在水平方向或垂直方向走,不能斜着走。 Input 第一行是两个整数,R和C,代表迷宫的长和宽。( 1<...原创 2019-03-22 21:59:50 · 1258 阅读 · 0 评论 -
UVA - 101 The Blocks Problem
题目链接https://vjudge.net/problem/UVA-101#author=0 背景 在计算机科学中的很多地方都会使用简单,抽象的方法来做分析和实验验究。比如在早期的规划学和机器人学的人工智能研究就利用一个积木世界,让机械臂执行操作积木的任务。 在这个问题中,你将在确定的规则和约束条件下构建一个简单的积木世界。这不是让你来研究怎样达到某种状态,而是编写一个“机械臂程序”来响...原创 2019-03-15 12:51:01 · 85 阅读 · 0 评论 -
OpenJ_Bailian - 2456 Aggressive cows (二分)
题目链接https://vjudge.net/problem/316445/origin 题目 Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (...原创 2019-04-12 12:25:53 · 146 阅读 · 0 评论 -
POJ - 3061 Subsequence (尺取法)
题目链接https://vjudge.net/problem/POJ-3061 题意 A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given...原创 2019-04-16 12:05:44 · 137 阅读 · 0 评论 -
ACM-ICPC 2018 徐州赛区网络预赛 H. Ryuji doesn't want to study (树状数组)
题目链接https://nanti.jisuanke.com/t/A2007 题目 Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, each book has its knowledgea[i]a[i]. Unfortunately, the...原创 2019-05-07 23:58:29 · 123 阅读 · 0 评论