随笔分类 -  ACM算法

摘要:On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played o 阅读全文
posted @ 2020-10-27 11:48 木子川 阅读(107) 评论(0) 推荐(0)
摘要:#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; //整数加法 void add(string &a,string &b){ if(a.size()<b.size 阅读全文
posted @ 2020-09-07 18:36 木子川 阅读(178) 评论(0) 推荐(0)
摘要:题目描述 牛牛正在打一场CF比赛时间为T分钟,有N道题,可以在比赛时间内的任意时间提交代码第i道题的分数为maxPoints[i],题目的分数随着比赛的进行,每分钟减少pointsPerMinute[i]这是一场比较dark的Cf,分数可能减成负数已知第i道题需要花费 requiredTime[i] 阅读全文
posted @ 2020-08-31 20:01 木子川 阅读(330) 评论(0) 推荐(0)
摘要:链接:https://ac.nowcoder.com/acm/problem/21313来源:牛客网 题目描述 牛牛喜欢整数序列,他认为一个序列美丽的定义是 1:每个数都在0到40之间 2:每个数都小于等于之前的数的平均值 具体地说:for each i, 1 <= i < N, A[i] <= ( 阅读全文
posted @ 2020-08-31 15:38 木子川 阅读(259) 评论(0) 推荐(0)
摘要:题目描述 牛牛喜欢这样的数组:1:长度为n2:每一个数都在1到k之间3:对于任意连续的两个数A,B,A<=B 与(A % B != 0) 两个条件至少成立一个请问一共有多少满足条件的数组,对1e9+7取模 输入描述: 输入两个整数n,k1 ≤ n ≤ 101 ≤ k ≤ 100000 输出描述: 输 阅读全文
posted @ 2020-08-31 14:10 木子川 阅读(176) 评论(0) 推荐(0)
摘要:#include <cstdio> #include <cstdlib> #include <climits> #include <fstream> #include <algorithm> #include <cmath> #include <deque> #include <vector> #i 阅读全文
posted @ 2020-08-31 13:47 木子川 阅读(256) 评论(0) 推荐(0)
摘要:斐波那契数列指的是这样一个数列: 这个数列从第3项开始,每一项都等于前两项之和。 1.递归形式 int fibonacci(int n) { if(n<=2) return 1; return fibonacci(n-1)+fibonacci(n-2); } 2.循环形式 F[1] = 1; F[2 阅读全文
posted @ 2020-02-24 14:59 木子川 阅读(1333) 评论(0) 推荐(0)
摘要:Nasa, being the most talented programmer of his time, can’t think things to be so simple. Recently all his neighbors have decided to connect themselve 阅读全文
posted @ 2019-11-12 21:55 木子川 阅读(191) 评论(0) 推荐(0)
摘要:In order to prepare the “The First National ACM School Contest” (in 20??) the major of the city decided to provide all the schools with a reliable sou 阅读全文
posted @ 2019-11-11 18:10 木子川 阅读(278) 评论(0) 推荐(0)
摘要:关于图的几个概念定义: 连通图:在无向图中,若任意两个顶点vivi与vjvj都有路径相通,则称该无向图为连通图。 强连通图:在有向图中,若任意两个顶点vivi与vjvj都有路径相通,则称该有向图为强连通图。 连通网:在连通图中,若图的边具有一定的意义,每一条边都对应着一个数,称为权;权代表着连接连个 阅读全文
posted @ 2019-11-09 21:44 木子川 阅读(316) 评论(0) 推荐(0)
摘要:次小生成树是指在一个树中除最小生成树外第二小的生成树,因此它是在最小生成树算法上衍生的。首先在求出最小生成树后,假如我们要加上一条树外的边,这样就会形成一个闭环,然后将这个闭环的最大 的边删除,那么剩下的依然是一个树,如果这个树<=最小生成树,那么它就是次小生成树。 如果我们要加边的话,加的肯定是树 阅读全文
posted @ 2019-11-09 21:43 木子川 阅读(182) 评论(0) 推荐(0)
摘要:什么是线段树线段树,是一种二叉搜索树。它将一段区间划分为若干单位区间,每一个节点都储存着一个区间。它功能强大,支持区间求和,区间最大值,区间修改,单点修改等操作。线段树的思想和分治思想很相像。线段树的每一个节点都储存着一段区间[L…R]的信息,其中叶子节点L=R。它的大致思想是:将一段大区间平均地划 阅读全文
posted @ 2019-11-09 21:43 木子川 阅读(420) 评论(0) 推荐(0)
摘要:During the Warring States Period of ancient China(476 BC to 221 BC), there were seven kingdoms in China they were Qi, Chu, Yan, Han, Zhao, Wei and Qin 阅读全文
posted @ 2019-11-09 21:42 木子川 阅读(237) 评论(0) 推荐(0)
摘要:During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, vil 阅读全文
posted @ 2019-11-08 20:58 木子川 阅读(187) 评论(0) 推荐(0)
摘要:A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Ea 阅读全文
posted @ 2019-11-06 21:31 木子川 阅读(116) 评论(0) 推荐(0)
摘要:For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultim 阅读全文
posted @ 2019-11-06 20:04 木子川 阅读(158) 评论(0) 推荐(0)
摘要:In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic 阅读全文
posted @ 2019-11-03 15:46 木子川 阅读(147) 评论(0) 推荐(0)
摘要:The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all pl 阅读全文
posted @ 2019-11-03 15:05 木子川 阅读(139) 评论(0) 推荐(0)
摘要:You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number 阅读全文
posted @ 2019-10-30 21:26 木子川 阅读(141) 评论(0) 推荐(0)
摘要:很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。 在每个测试的第一行, 阅读全文
posted @ 2019-10-29 15:38 木子川 阅读(208) 评论(0) 推荐(0)