![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数学几何
文章平均质量分 61
大 聪 明
Big Smart
展开
-
负数取余问题
定义2取余的结果就会导致出现两个余数了,比如5%(-3) = (-3)x(-1)+2 = (-3)x(-2)-1,所以这里的余数2和-1都满足定义。1)定义1:如果a和d是两个自然数,d非零,可以证明存在两个唯一的整数 q 和 r,满足a=qd+r且0 ≤ r < d(其中q为商,r为余数)。,即5%(-3) 的结果为2而不是-1,(-5)%3的结果是-2而不是1。5%(-3)=(-3)x(-1)+2,商为-1,余数为2。(-5)%(-3)=(-3)x2+1,商为2,余数为1。原创 2023-11-10 20:18:58 · 1672 阅读 · 0 评论 -
计蒜客 - A1603 天上的星星(二维前缀和)
传送门分析:典型模板题,模板分为详细版和简洁版。此题有一点小坑是查询的区间可能比标数的区间大,所有必须遍历到2000后。视频教程详细版:#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int a[2010][2010],sum[2010][2010];int cul(int x1,int y1,int x2,int y2){ if(!x1&&a原创 2021-12-26 23:04:56 · 409 阅读 · 0 评论 -
LightOJ - 1007 Mathematically Hard(欧拉函数质数打表)
LINKMathematically some problems look hard. But with the help of the computer, some problems can be easily solvable.In this problem, you will be given two integers a and b. You have to find the summation of the scores of the numbers from a to b (inclusiv原创 2021-08-27 20:23:10 · 97 阅读 · 0 评论 -
CodeForces - 1534B. 直方图丑陋度(几何)
我是传送门Little Dormi received a histogram with n bars of height a1,a2,…,an for Christmas. However, the more he played with his new histogram, the more he realized its imperfections, so today he wanted to modify it to his liking.To modify the histogram, Litt原创 2021-07-09 16:20:17 · 165 阅读 · 0 评论