![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数学
文章平均质量分 81
mmk27
这个作者很懒,什么都没留下…
展开
-
ICPC Asia HongKong 2017
南京已成炮灰,徐州加油!A:java二分import java.math.*;import java.util.*;public class Main { public static void main(String [] args){ Scanner cin=new Scanner(System.in); int t,n; BigInteger z,zn,znjyn,...原创 2019-10-29 21:18:38 · 136 阅读 · 0 评论 -
2019牛客暑期多校训练营(第一场)B Integration 裂项相消 + 积分
题目链接:https://ac.nowcoder.com/acm/contest/881/B题解:裂项相消,以此类推,对于每一项,都是这样的形式,分母上常数项 是其他项的系数减去该项的系数 的乘积积分化简 :#include <bits/stdc++.h>using namespace std;typedef long long ll;c...原创 2019-07-18 20:10:56 · 488 阅读 · 0 评论 -
2019杭电多校 HDU - 6608 Fansblog 威尔逊定理
题目链接:https://vjudge.net/problem/HDU-6608题意:找到小于素数p的最大素数Q,求Q!题解:威尔逊定理:p为素数时:( p -1 )! ≡ -1 ( mod p ),1e18内两素数之间的差距也就几百,直接除去Q到q内的数即可,注意要用到快速乘,因为两个数相乘会超long long#include<cstdio>#include<...原创 2019-07-30 09:33:18 · 268 阅读 · 0 评论 -
Contest1803 - 2019年第二阶段我要变强个人训练赛第十八场 问题 B: 无聊游戏 推公式+线段树
题目链接:http://icpc.upc.edu.cn/problem.php?cid=1803&pid=1题目描述小N和小A在玩这样的一个游戏:给定初始数列Q,小N先把某个前缀(可以为空)的数字全部乘上−A,小A再把某个后缀(可以为空)的数字全部乘上−B,小N想让最后所有数的和尽量大,而小A想让最后所有数的和尽量的小。因为小A无比聪明绝对不会失误,所以小N想找到某个方法使得最后...原创 2019-07-30 18:34:33 · 125 阅读 · 0 评论 -
2019 Multi-University Training Contest 1 Operation 线性基
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6579题意:给出n个数,m次操作,0 l r 求[l, r] 任意数的异或和最大,1 x 在最后加一个x题解:二维线性基,p[i][j] 记录下从头到i这个位置的线性基,对于每个线性基,取与最右边的数形成的线性基并记录下位置,这样能保证,对于每个位置r,保存的线性基都是在靠近r形成的,因此在查询...原创 2019-07-22 21:01:35 · 126 阅读 · 0 评论 -
2019 杭电多校 Just an Old Puzzle HDU - 6620 数字华容道有解
题目链接:https://vjudge.net/problem/HDU-6620题解:#include <bits/stdc++.h>using namespace std;int a[20];int n;int main( ) { int T; scanf("%d", &T); int flag, x, ans; while(...原创 2019-07-31 19:01:41 · 769 阅读 · 3 评论 -
2019 杭电多校 HDU - 6623 Minimal Power of Prime 因子幂最小
题目链接:https://vjudge.net/problem/HDU-6623题意:输出n,所以质因子幂的最小值题解:先处理1e4以内的质数,也就1000多个,然后如果没有除尽的话,因子最多也就4个了,所以幂数大于1的情况有p1^4,p1^3, p1^2 , p1^2*p2^2, 对于其他情况肯定有幂为1的。#include<cstdio>#include<c...原创 2019-07-31 19:11:29 · 1080 阅读 · 8 评论 -
2019牛客多校 第七场 B Irreducible Polynomial 多项式因式分解判断
链接:https://ac.nowcoder.com/acm/contest/887/B来源:牛客网Irreducible Polynomial时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述In mathematics, a polynomial is an express...原创 2019-08-08 21:30:48 · 403 阅读 · 0 评论 -
牛客练习赛51 C、勾股定理 只一边求另外两边 结论
链接:https://ac.nowcoder.com/acm/contest/1083/C来源:牛客网勾股定理时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536KSpecial Judge, 64bit IO Format: %lld题目描述给出直角三角形其中一条边的长度n,你的任务是构造剩下的两条边,使这三条边能构成一个直角三...原创 2019-09-07 10:11:28 · 456 阅读 · 0 评论 -
问题 J: Floating-Point Hazard 求导
题目链接:http://icpc.upc.edu.cn/problem.php?cid=1740&pid=9题意:题解:因为10^-15这个很小,所以就可以看做对(x)^1/3求导,得到1 / 3 * (x) ^ (- 2 / 3 )#include<bits/stdc++.h>using namespace std;int main(){ int l,...原创 2019-04-29 23:08:21 · 181 阅读 · 0 评论 -
ZOJ - 4101 Element Swapping 解方程
题目链接:https://cn.vjudge.net/problem/ZOJ-4101题意:有多少中方式,交换两个位置的数字,使两个公式都成立题解:按照原序列 求出 sum1+=(ll)i*a[i]; sum2+=(ll)i*a[i]*a[i]; 假设i ,j 交换,解方程的到a[i]+a[j]=(y-sum2)/(x-sum1),若x=sum1,y=sum2,那就按照数字一样的算,...原创 2019-04-28 18:12:16 · 743 阅读 · 0 评论 -
∞ 等差等比前n项和
链接:https://ac.nowcoder.com/acm/contest/624/C来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 65536K,其他语言131072K64bit IO Format: %lld题目描述∞, the infinity. It's one of the most complex math symbols. How d...原创 2019-04-14 17:20:36 · 633 阅读 · 0 评论 -
ZOJ - 3870 Team Formation 异或 规律
For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university.Edward knows the skill level of each student. He has fou...原创 2018-11-29 11:09:53 · 156 阅读 · 0 评论 -
HDU - 6185 Covering 矩阵快速幂
Bob's school has a big playground, boys and girls always play games here after school.To protect boys and girls from getting hurt when playing happily on the playground, rich boy Bob decided to cover...原创 2018-12-06 16:10:36 · 192 阅读 · 0 评论 -
CodeChef - ZUBRIDER Club of Riders 数学 组合数
At a shopping mall, every now and then, a naughty kid steals some chocolates from different chocolate shops and runs away. The guards in the shopping mall were unable to catch the kid as he has got a ...原创 2018-12-19 22:48:31 · 257 阅读 · 0 评论 -
Gym - 101972I Secret Project 组合数+思维
There are n students working on a secret project, this project is very important and unique, so they decided to keep it safe, and protect it from leakage.The students will put all the project's docu...原创 2018-12-16 12:14:36 · 535 阅读 · 0 评论 -
Gym - 101972J Even Numbers 规律
Yousef loves playing with functions in his free time. Today, he invents the following function:Yousef will give you a list of queries, and you need to find the answers for them. For each query, yo...原创 2018-12-16 12:28:06 · 378 阅读 · 1 评论 -
CodeForces - 450B Jzzhu and Sequences 规律
Jzzhu has invented a kind of sequences, they meet the following property:You are given x and y, please calculate fn modulo 1000000007 (109 + 7).InputThe first line contains two integers x and ...原创 2018-12-12 11:48:42 · 118 阅读 · 0 评论 -
CodeForces - 450C Jzzhu and Chocolate 数学 贪心
Jzzhu has a big rectangular chocolate bar that consists of n × m unit squares. He wants to cut this bar exactly k times. Each cut must meet the following requirements:each cut should be straight (ho...原创 2018-12-12 12:03:29 · 144 阅读 · 0 评论 -
ZOJ - 3956 Course Selection System 公式转化为 0 1背包
题目链接:点击查看题意:给出n个,hi和ci,随便选出m个来,要求这个最大,即 sum(H)*(sum(H)- sum(C)) - sum(C) * sum(C)最大,因为c最大为100,一共100个,所以我们就可以吧C的总和作为背包容量,求一个最大的H和了#include<bits/stdc++.h>using namespace std;typedef lon...原创 2019-04-05 12:42:28 · 101 阅读 · 0 评论 -
ZOJ - 4029 Now Loading!!! 前缀和+二分
题意:m次计算,对于给出的式子求和题解:因为分母取了log 所以分母的范围就在1-30 之间 ,所以数组a先排序,预处理求一下 除每个数的前缀和,对于每一个p,二分查找对应的区间即可,复杂度 n*log(n)*log(n),数组不要开太大 会报ML#include<iostream>#include<cstdio>#include<cstring>...原创 2018-11-23 12:13:19 · 105 阅读 · 0 评论