oftest

CF 683 DIV.2 B. Numbers Box

无人久伴 提交于 2020-11-19 17:51:14
题目: You are given a rectangular grid with n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value aij written in it. You can perform the following operation any number of times (possibly zero): Choose any two adjacent cells and multiply the values in them by −1. Two cells are called adjacent if they share a side. Note that you can use a cell more than once in different operations. You are interested in X, the sum of all the numbers in the grid. What is the maximum X you can achieve with these operations? Input Each test contains

HDU 6808 Go Running(利用网络流求二分图的最小顶点覆盖、dinic)

耗尽温柔 提交于 2020-08-15 04:24:53
原题地址: http://acm.hdu.edu.cn/showproblem.php?pid=6808 本文主要参考的博客: https://www.cnblogs.com/stelayuri/p/13405914.html Go Running Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 1358 Accepted Submission(s): 500 Problem Description Zhang3 is the class leader. Recently she's implementing a policy about long-distance running. This forces every student in her class to take a run. There is a main road in the school from west to east, which can be regarded as an infinite axis, and its positive direction is east. Positions on the road are

mysql创建定时执行存储过程任务

删除回忆录丶 提交于 2020-08-14 12:21:21
sql语法很多,是一门完整语言。这里仅仅实现一个功能,不做深入研究。 目标:定时更新表或者清空表。 案例:曾经做过定时清空位置信息表的任务。(然而,当时并未考虑服务器挂掉后的情况) 本次测试:每5s更新表字段+1 1.prepare 创建一个表: DROP TABLE IF EXISTS `test_sche`; CREATE TABLE `test_sche` ( `id` int(11) NOT NULL, `counts` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of test_sche -- ---------------------------- INSERT INTO `test_sche` VALUES ('1', '188');    2.创建一个存储过程 CREATE DEFINER=`root`@`localhost` PROCEDURE `add`() BEGIN #Routine body goes here... UPDATE test_sche SET counts=counts+1 WHERE id=1; END 注意,创建存储过程的时候

机器学习10种经典算法的Python实现

一个人想着一个人 提交于 2020-08-14 03:07:09
广义来说,有三种机器学习算法 1、 监督式学习 工作机制:这个算法由一个目标变量或结果变量(或因变量)组成。这些变量由已知的一系列预示变量(自变量)预测而来。利用这一系列变量,我们生成一个将输入值映射到期望输出值的函数。这个训练过程会一直持续,直到模型在训练数据上获得期望的精确度。监督式学习的例子有:回归、决策树、随机森林、K – 近邻算法、逻辑回归等。 2、非监督式学习 工作机制:在这个算法中,没有任何目标变量或结果变量要预测或估计。这个算法用在不同的组内聚类分析。这种分析方式被广泛地用来细分客户,根据干预的方式分为不同的用户组。非监督式学习的例子有:关联算法和 K – 均值算法。 3、强化学习 工作机制:这个算法训练机器进行决策。它是这样工作的:机器被放在一个能让它通过反复试错来训练自己的环境中。机器从过去的经验中进行学习,并且尝试利用了解最透彻的知识作出精确的商业判断。 强化学习的例子有马尔可夫决策过程。 常见机器学习算法名单 这里是一个常用的机器学习算法名单。这些算法几乎可以用在所有的数据问题上: 线性回归 逻辑回归 决策树 SVM 朴素贝叶斯 K最近邻算法 K均值算法 随机森林算法 降维算法 Gradient Boost 和 Adaboost 算法 1、线性回归 线性回归通常用于根据连续变量估计实际数值(房价、呼叫次数、总销售额等)

Codeforces 1354C2

∥☆過路亽.° 提交于 2020-08-10 22:28:15
题面 Time limit per test: 2 seconds Memory limit per test: 256 megabytes Description You are given a regular polygon with 2⋅n vertices (it's convex and has equal sides and equal angles) and all its sides have length 1 . Let's name it as 2n -gon. Your task is to find the square of the minimum size such that you can embed 2n -gon in the square. Embedding 2n -gon in the square means that you need to place 2n -gon in the square in such way that each point which lies inside or on a border of 2n -gon should also lie inside or on a border of the square. You can rotate 2n -gon and/or the square. Input

Codeforces 1354C2

China☆狼群 提交于 2020-08-10 18:46:42
题面 Time limit per test: 2 seconds Memory limit per test: 256 megabytes Description You are given a regular polygon with 2⋅n vertices (it's convex and has equal sides and equal angles) and all its sides have length 1 . Let's name it as 2n -gon. Your task is to find the square of the minimum size such that you can embed 2n -gon in the square. Embedding 2n -gon in the square means that you need to place 2n -gon in the square in such way that each point which lies inside or on a border of 2n -gon should also lie inside or on a border of the square. You can rotate 2n -gon and/or the square. Input

Codeforces 1354C2

北城以北 提交于 2020-08-10 17:35:36
题面 Time limit per test: 2 seconds Memory limit per test: 256 megabytes Description You are given a regular polygon with 2⋅n vertices (it's convex and has equal sides and equal angles) and all its sides have length 1 . Let's name it as 2n -gon. Your task is to find the square of the minimum size such that you can embed 2n -gon in the square. Embedding 2n -gon in the square means that you need to place 2n -gon in the square in such way that each point which lies inside or on a border of 2n -gon should also lie inside or on a border of the square. You can rotate 2n -gon and/or the square. Input

HDU

你说的曾经没有我的故事 提交于 2020-08-10 13:59:09
Super Mario HDU - 4417 Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Mario needs to save his lover. We regard the road to the boss’s castle as a line (the length is n), on every integer point i there is a brick on height hi. Now the question is how many bricks in L , R Mario can hit if the maximal height he can jump is H. InputThe first line follows an integer T, the number of test data. For each test data: The first line contains two integers n, m (1 <= n <=10^5, 1 <= m <= 10^5), n is the

#651 (Div. 2)C. Number Game(博弈论,思维)

喜你入骨 提交于 2020-08-10 07:15:57
题目描述 Ashishgup and FastestFinger play a game. They start with a number n and play in turns. In each turn, a player can make any one of the following moves: Divide n by any of its odd divisors greater than 1. Subtract 1 from n if n is greater than 1. Divisors of a number include the number itself. The player who is unable to make a move loses the game. Ashishgup moves first. Determine the winner of the game if both of them play optimally. Input The first line contains a single integer t (1≤t≤100) — the number of test cases. The description of the test cases follows. The only line of each test

HDU 6194 string string string 后缀数组+lcp、Two Pointers

北慕城南 提交于 2020-08-09 12:04:03
string string string Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 989 Accepted Submission(s): 285 Problem Description Uncle Mao is a wonderful ACMER. One day he met an easy problem, but Uncle Mao was so lazy that he left the problem to you. I hope you can give him a solution. Given a string s, we define a substring that happens exactly k times as an important string, and you need to find out how many substrings which are important strings. Input The first line contains an integer T ( T ≤ 100 ) implying the number of test cases. For each