
思维题
文章平均质量分 68
如风如影�
这个作者很懒,什么都没留下…
展开
-
arc125 C - Squares (思维+数学推导)
Squares题目链接: link.题意:给定一个n,找一对x,y满足以下条件: 1≤x,y≤N; x^2-y是个完全平方数(可以是0);找出有多少对x,y满足条件;N<=1e12;#include <bits/stdc++.h>using namespace std;const int mod=998244353;int main(){ long long n; cin>>n; long long sum=0;原创 2021-09-03 21:33:03 · 304 阅读 · 2 评论 -
Fear Factoring(数论,除法分块)
Fear Factoring题目链接: link.题意:给a,b两个数,求a到b所有数的因数和。 题目分析:我们考虑依次枚举1-n中的每一个约数,比如在1-7中,2是2、4、6的约数,3是3、6的约数,4是4的约数,可以发现每一个约数x在1-7中出现的次数是7/x(向下取整),推广到一般情况,对于1-n中的约数x,它最多是n/x个 数 的因子,也就是说,我们要求S(题目描述中有),可以分别求出每一个约数(这里的约数就是1-n中的每一个数)出现的次数并和约数相乘在累加。比如:1-n: 1原创 2021-08-04 09:19:42 · 216 阅读 · 0 评论 -
Dice (III)(概率,期望)
Dice (III)题目链接: link.原题描述Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that the dice is fair, that means when you throw the dice, the probability of occurr原创 2021-07-28 08:21:09 · 631 阅读 · 0 评论 -
Shortest Path with Obstacle--曼哈顿距离(cf补题)
Shortest Path with Obstacle题目链接: link.原题描述There are three cells on an infinite 2-dimensional grid, labeled A, B, and F. Find the length of the shortest path from A to B if:in one move you can go to any of the four adjacent cells sharing a side;visitin原创 2021-07-21 20:53:11 · 274 阅读 · 1 评论 -
SDUT 2021 Winter Individual Contest - N(B-Derangement)
B - Derangement题目链接: link.原题描述:A permutation of n numbers is a sequence of integers from 1 to n where each number is occurred exactly once. If a permutation p1, p2, …, pn has an index i such that pi = i, this index is called a fixed point.A derangement原创 2021-03-24 20:59:17 · 161 阅读 · 0 评论