数学 物理题 思维
文章平均质量分 83
obsorb_knowledge
心有不甘,呼唤着我
展开
-
最小二乘法
首先给出公式最小二乘法的公式y = a*x+ b;其中式中N是数据点的个数。注意,以上两式具有相同的分母,∑指逐项加法计算(取和)。∑x指对所有的x值求和,∑y指对所以的y值求和,∑(x^2)指对所有x的平方求和。∑xy指对所有的积xy进行取和计算。应注意,∑xy 与 ∑x*∑y是不相同的(“积的和”与“和的积”是不同的),同样(∑x)^2与∑(x^2)也是不相同的(“和的平方”与...原创 2019-09-26 10:19:50 · 7506 阅读 · 0 评论 -
2018 ACM-ICPC 中国大学生程序设计竞赛线上赛 Goldbach(2^63 次方内的素数判断,Miller-Rabin素数检测算法)
Description:Goldbach's conjecture is one of the oldest and best-known unsolved problems in number theory and all of mathematics. It states:Every even integer greater than 2 can be expressed as the sum...原创 2018-04-24 17:23:25 · 323 阅读 · 0 评论 -
2 3 5 7的倍数 51Nod - 1284 (2,3,5,7的倍数,容斥问题)
给出一个数N,求1至N中,有多少个数不是2 3 5 7的倍数。 例如N = 10,只有1不是2 3 5 7的倍数。Input输入1个数N(1 <= N <= 10^18)。Output输出不是2 3 5 7的倍数的数共有多少。Sample Input10Sample Output1代码:#include<stdio.h>#include<string.h>#...原创 2018-05-01 17:00:33 · 246 阅读 · 0 评论 -
Super-palindrome HDU - 6264 (改变字符,把每个字符串的奇数子串都变成回文的,一定要善于观察)
题目描述You are given a string that is consisted of lowercase English alphabet.You are supposed to change it into a super-palindrome string in minimum steps.You can change one character in string to anoth...原创 2018-04-23 19:45:55 · 710 阅读 · 0 评论 -
2018 ACM-ICPC 中国大学生程序设计竞赛线上赛 (Reversion Count) (一个数和一个数的倒序的差一定是 9的倍数,还有...)
Description:There is a positive integer X, X's reversion count is Y. For example, X=123, Y=321; X=1234, Y=4321. Z=(X-Y)/9, Judge if Z is made up of only one number(0,1,2...9), like Z=11,Z=111,Z=222,do...原创 2018-04-23 16:20:08 · 595 阅读 · 0 评论 -
Sumsets POJ - 2549 (从 一个 1000数中,找出四个数,满足 a + b = d -c,且求的d最大)
Given S, a set of integers, find the largest d such that a + b + c = d where a, b, c, and d are distinct elements of S.InputSeveral S, each consisting of a line containing an integer 1 <= n <= 1...原创 2018-04-13 18:05:04 · 259 阅读 · 0 评论 -
2018 ACM-ICPC 中国大学生程序设计竞赛线上赛 Copy and Submit II (结论题,数学,好题)
Description:1// Q.cpp2#include <iostream>3using namespace std;4const long long M = 1000000007;5const long long MAXL = 1000000;6long long a[MAXL];7long long Q(int n, long long t)8{9 if(n < ...原创 2018-04-23 15:13:06 · 333 阅读 · 0 评论 -
1068: zdw的编译器(模拟题,里面要注意括号配对)
1068: zdw的编译器时间限制: 1 Sec 内存限制: 128 MB提交: 28 解决: 10[提交][状态][讨论版]题目描述zdw参照某种语言的灵感,自创了一种语言,名字叫:AK语言(因为他总能AK)AK语言非常简单,只包含8个符号,以下是关于这种语言的介绍:> 当前指针向右移动< 当前指针向左移动+ 指针指向的字节数值增加1- 指针指向的字节数值减少1? 等待用户输入字...原创 2018-04-13 15:35:52 · 150 阅读 · 0 评论 -
组合数学 和 dp 的递推式 和杨辉三角 三者之间的联系
1072: 简单的问题时间限制: 1 Sec 内存限制: 128 MB提交: 26 解决: 6[提交][状态][讨论版]题目描述这个问题太简单了以至于出题人想不到什么捏造什么背景了(脑洞缺失那就让我们直奔主题吧:给你一个n,你能否知道,在[0,n)中,有多少数的二进制表示中1的个数和n的二进制表示中1的个数是一样多的?输入:第一行一个T,表示有T组数据其后T行,每行一个整数,代表n输出:n行每...原创 2018-04-13 11:40:03 · 204 阅读 · 0 评论 -
Boxes and Balls UVALive - 7500 (找规律,二分搜索)
题目链接:点击打开链接题意:你手里有N个球,现在需要用你手里尽可能多的球使得这个游戏经过多次游戏后形成一种恒定状态,恒定状态:最后形成一种恒定状态的情况是每个盒子里放得球数一定是个连续的序列,1 1,2 1,2,3 1,2,3,4.... 思路:经分析:找一个小于等于n的 等差序列前 k 项和,这个等差序列从 a1 = 1 d = 1 n>=(k*(k+1))/2;二分枚举k,即可...原创 2018-04-17 09:23:14 · 114 阅读 · 0 评论 -
第八届 蓝桥杯 称重计算
标题:承压计算X星球的高科技实验室中整齐地堆放着某批珍贵金属原料。每块金属原料的外形、尺寸完全一致,但重量不同。金属材料被严格地堆放成金字塔形。 7 5 8 7 8 8 9 2 7 ...原创 2018-03-28 20:56:46 · 174 阅读 · 0 评论 -
Card Game (First Edition) FZU - 2264 Card Game (Second Edition) FZU - 2265 (数学期望)
Fat brother and Maze are playing a kind of special (hentai) game with some cards. There are N*2 cards in this game for the players to use, this is the card deck. The game goes for N rounds and in each...原创 2018-04-26 11:14:54 · 971 阅读 · 0 评论 -
Seating Arrangement CSU - 1997 (思维题,是否存在n个数的序列,使得相邻啷个数的差绝对值大于d)
Mr. Teacher老师班上一共有n个同学,编号为1到n。 在上课的时候Mr. Teacher要求同学们从左至右按1, 2, …, n的顺序坐成一排,这样每个同学的位置是固定的,谁没来上课就一目了然了。但是时间长了之后,Mr. Teacher发现坐得离得远的同学往往因为交流很少而逐渐变得生疏了,于是他决定重新安排同学们的座位,并且在新的座位安排中,任意两个相邻的同学的编号之差的绝对值都必须大于d...原创 2018-05-17 09:52:51 · 1193 阅读 · 0 评论 -
Buy Fruits(打表,找规律,构造)
链接:https://ac.nowcoder.com/acm/contest/847/C来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536KSpecial Judge, 64bit IO Format: %lld题目描述在blueland上有nn个水果店,它们的编号依次为0,1,2...n−10,1,2...n−...原创 2019-05-04 10:58:30 · 344 阅读 · 0 评论 -
Tic-Tac-Toe
链接:https://ac.nowcoder.com/acm/contest/847/B来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述Alice和Bob正在下井字棋,顾名思义,在3*3棋盘上先完成三子连珠(横、竖,或者斜对角线)的玩家将获胜。Alice执白子...原创 2019-05-04 10:44:35 · 268 阅读 · 0 评论 -
Codeforces Round #511 (Div. 2) C. Enlarge GCD(消掉最少的数,让所有数的最大公约数变大)
C. Enlarge GCDtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMr. F has nn positive integers, a1,a2,…,ana1,a2,…,an.He thinks th...原创 2018-10-01 17:46:02 · 510 阅读 · 2 评论 -
Codeforces Round #498 (Div. 3) D. Two Strings Swaps(思维,多种情况讨论)
D. Two Strings Swapstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two strings aa and bb consisting of lowercase ...原创 2018-08-13 11:20:13 · 136 阅读 · 0 评论 -
CKOJ 1066: 地形编辑器(整个区间加减一个数,多次区间操作,处理端点,但这是二维的,骚操作(有dp思想))
1066: 地形编辑器时间限制: 1 Sec 内存限制: 128 MB提交: 32 解决: 4[提交][状态][讨论版]题目描述zdw很喜欢玩红警, 他经常制作一些奇奇怪怪的红警地图当他制作地图的时候, 经常需要用到地形编辑器zdw可以用这个编辑器将地图上的某个区域的高度改变x来创造地形一次显然是不够的, 而经过若干次的操作后, 地图上将会出现各种山脉和峡谷现给出zdw的所有操作, 求这些操作...原创 2018-05-29 21:11:32 · 541 阅读 · 0 评论 -
Now Loading!!! ZOJ - 4029 (二分+前缀和+思维)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4029DreamGrid has integers . DreamGrid also has queries, and each time he would like to know the value offor a given number , wh...原创 2018-05-15 09:59:22 · 167 阅读 · 0 评论 -
E. Bus Video System(找刚开始车上,满足的人数,好题,细节多)
E. Bus Video Systemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe busses in Berland are equipped with a video surveillance system. The system ...原创 2018-05-14 19:39:02 · 3767 阅读 · 0 评论 -
一维战舰 51Nod - 1521 (set 二分查找,判断撒谎)
爱丽丝和鲍博喜欢玩一维战舰的游戏。他们在一行有n个方格的纸上玩这个游戏(也就是1×n的表格)。在游戏开始的时候,爱丽丝放k个战舰在这个表格中,并不把具体位置告诉鲍博。每一只战舰的形状是 1×a 的长方形(也就是说,战舰会占据a个连续的方格)。这些战舰不能相互重叠,也不能相接触。然后鲍博会做一系列的点名。当他点到某个格子的时候,爱丽丝会告诉他那个格子是否被某只战舰占据。如果是,就说hit,否则就说m...原创 2018-05-13 16:09:58 · 244 阅读 · 0 评论 -
Cutting Game FZU - 2268 (找规律题,二进制,n最少分出几段,组成小于等于n任意数)
Fat brother and Maze are playing a kind of special (hentai) game with a piece of gold of length N where N is an integer. Although, Fat Brother and Maze can buy almost everything in this world (except ...原创 2018-04-26 15:14:29 · 307 阅读 · 0 评论 -
The Bigger the Better FZU - 2267 (模拟题,模拟中间有技巧,目前后缀数组不会,暂且不用)
Fat brother and Maze are playing a kind of special (hentai) game with two integers. All the digits of these two integers are in the range from 1 to 9. After they’ve got these two integers, they though...原创 2018-04-26 14:26:18 · 201 阅读 · 0 评论 -
Pair Of Lines CodeForces - 961D (数学 直线 上的几何)
You are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct.You may draw two straight lines (not necessarily dis...原创 2018-04-11 08:52:29 · 203 阅读 · 0 评论 -
0和5 51Nod - 1433 (为什么整除找出一个最大的整数能整除3或者9,为什么)
小K手中有n张牌,每张牌上有一个一位数的数,这个字数不是0就是5。小K从这些牌在抽出任意张(不能抽0张),排成一行这样就组成了一个数。使得这个数尽可能大,而且可以被90整除。注意:1.这个数没有前导0,2.小K不需要使用所有的牌。Input每个测试数据输入共2行。 第一行给出一个n,表示n张牌。(1<=n<=1000) 第二行给出n个整数a00,a11,a22,…,an−1n−1 (a...原创 2018-04-16 14:37:16 · 1165 阅读 · 0 评论 -
4 Values whose Sum is 0 poj-2785(四个长度为4000的数组,从每个数组中取出一个数,使取出的四个数和为0 二分优化)
The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0 . In the followin...原创 2018-04-09 22:02:02 · 363 阅读 · 0 评论 -
51Nod - 1019 (求逆序数)
在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。如2 4 3 1中,2 1,4 3,4 1,3 1是逆序,逆序数是4。给出一个整数序列,求该序列的逆序数。Input第1行:N,N为序列的长度(n 第2 - N + 1行:序列中的元素(0 ii <= 10^9)Output输出逆原创 2017-12-05 19:37:35 · 283 阅读 · 0 评论 -
CodeForces - 892B Wrath(每一个人有一把长度为a[i]的武器,这个人能把左边距离为他为a[i]的能人全杀完,看看最终会留下多少人)
Hands that shed innocent blood!There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people k原创 2017-12-01 19:13:01 · 318 阅读 · 0 评论 -
CodeForces - 894B Ralph And His Magic Field(给出n*m的格子 和 k为1或-1,往里填1 或 -1,使得每一行和每一列都和k相等)
Ralph has a magic field which is divided into n × m blocks. That is to say, there are n rows and m columns on the field. Ralph can put an integer in each block. However, the magic field doesn't alwa原创 2017-12-01 17:05:14 · 410 阅读 · 0 评论 -
Least Common Multiple HDU 1019(一列数的最小公倍数)
The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105. Inp原创 2017-12-09 10:21:00 · 149 阅读 · 0 评论 -
CodeForces - 892C Pride (n个数,求相邻两个数的最大公约数替换其中一个数,看要操作几次使得n个数全部变成1)
You have an array a with length n, you can perform operations. Each operation is like this: choose two adjacent elements from a, say x and y, and replace one of them with gcd(x, y), where gcd denote原创 2017-11-28 21:51:39 · 1031 阅读 · 0 评论 -
CodeForces - 877C Slava and tanks (在这个位置的炸一下,这个位置的坦克就跑到相邻的其中一个位置,一个坦克炸两下才能坏 ,求最小的轰炸数)
Slava plays his favorite game "Peace Lightning". Now he is flying a bomber on a very specific map.Formally, map is a checkered field of size 1 × n, the cells of which are numbered from 1 to n, in ea原创 2017-11-03 20:05:31 · 313 阅读 · 0 评论 -
CodeForces - 492D Vanya and Computer Game (一道数学思维题,可以说是最大公约数,最小公倍数为一个周期,再找在这一个周期中能打多少拳,拳数的周期)
Vanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character performs attack with frequency x hits per second and Vova's character performs原创 2017-10-26 17:45:06 · 330 阅读 · 0 评论 -
CodeForces - 879B Table Tennis (不要只顾这个数的一边,这个数的前面和后面都的顾)
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person fro原创 2017-11-03 10:44:46 · 664 阅读 · 0 评论 -
HDU - 6025 Coprime Sequence(给出一行数,去掉其中一个数,求这行数的最大的最大公约数(gcd)))
Do you know what is called ``Coprime Sequence''? That is a sequence consists of nnpositive integers, and the GCD (Greatest Common Divisor) of them is equal to 1. ``Coprime Sequence'' is easy to fi原创 2017-10-28 10:59:48 · 496 阅读 · 0 评论 -
HDU - 5090 考思维,变成安顺序排的数列
Tom and Jerry are playing a game with tubes and pearls. The rule of the game is: 1) Tom and Jerry come up together with a number K. 2) Tom provides N tubes. Within each tube, there are several原创 2017-10-02 09:40:40 · 292 阅读 · 0 评论 -
康拓展开
康托展开是什么?定义:X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0!ai为整数,并且0简单点说就是,判断这个数在其各个数字全排列中从小到大排第几位。比如 132,在1、2、3的全排列中排第2位。康托展开有啥用呢?维基:n位(0~n-1)全排列后,其康托展开唯一且最原创 2017-12-21 20:49:32 · 329 阅读 · 0 评论 -
UVA - 10341 Solve It (高精度 二分法解方程)
题目链接:点击打开链接题意 找一个0 到 1之间的数使得方程满足,若没有输出 No solution;题解:首先方程根据给出的 数 的范围可知:方程为单调递减,这样就可以运用二分解方程了代码:#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#include...原创 2017-12-17 09:44:38 · 233 阅读 · 0 评论 -
HDU - 1999 不可摸数 (所有的真因子和,类似于素数筛选的那个过程写的)
s(n)是正整数n的真因子之和,即小于n且整除n的因子和.例如s(12)=1+2+3+4+6=16.如果任何 数m,s(m)都不等于n,则称n为不可摸数. Input包含多组数据,首先输入T,表示有T组数据.每组数据1行给出n(2<=n<=1000)是整数。Output如果n是不可摸数,输出yes,否则输出noSample Input3258Sample Outputyesye...原创 2018-03-29 21:40:30 · 248 阅读 · 0 评论 -
HDU - 1280 前m大的数
还记得Gardon给小希布置的那个作业么?(上次比赛的1005)其实小希已经找回了原来的那张数表,现在她想确认一下她的答案是否正确,但是整个的答案是很庞大的表,小希只想让你把答案中最大的M个数告诉她就可以了。 给定一个包含N(N<=3000)个正整数的序列,每个数不超过5000,对它们两两相加得到的N*(N-1)/2个和,求出其中前M大的数(M<=1000)并按从大到小的顺序排列。In...原创 2018-03-29 20:56:52 · 230 阅读 · 0 评论