目录 题目链接 思路 代码 题目链接 传送门 思路 首先我们将原式化简: \[ \begin{aligned} &\sum\limits_{l_1=1}^{n}\sum\limits_{l_2=1}^{n}\dots\sum\limits_{l_k=1}^{n}gcd(l_1,l_2,\dots,l_k)^2&\\ =&\sum\limits_{d=1}^{n}d^2\sum\limits_{l_1=1}^{n}\sum\limits_{l_2=1}^{n}\dots\sum\li…
Description: 定义函数 \[ f _n (k) = \sum _{l _1 = 1} ^n \sum _{l _2 = 1} ^n \cdots \sum _{l _k = 1} ^n \gcd(l _1, l _2, \cdots, l _k) ^2 \] 现给定 \(n, k\),需要求出 \(\sum _{i = 2} ^k f _n (i)\),答案对 \(10 ^9 + 7\) 取模. \(T\) 组数据. \[ 1 \le T \le 10, 1 \le n \le 10…
传送门 题意: 统计\(k\)元组个数\((a_1,a_2,\cdots,a_n),1\leq a_i\leq n\)使得\(gcd(a_1,a_2,\cdots,a_k,n)=1\). 定义\(f(n,k)\)为满足要求的\(k\)元组个数,现在要求出\(\sum_{i=1}^n f(i,k),1\leq n\leq 10^9,1\leq k\leq 1000\). 思路: 首先来化简一下式子,题目要求的就是: \[ \begin{aligned} &\sum_{i=1}^n\sum_{j=1…
计蒜客题目链接:https://nanti.jisuanke.com/t/41303 题目:给你一个序列a,你可以从其中选取元素,构建n个串,每个串的长度为n,构造的si串要满足以下条件, 1. si[1]=i . 2. si[j]<si[j-1] 3. |pos[j] -pos[j-1]|<=k 并且每个a中的元素只能用一次 4. 两个串大小的定义时 前k项相等的前提(k和前面不是一个),Ck>Dk,则C大于D 求Si的长度,并输出 由于Si[ j ] < Si[j - 1] ,…
2019ICPC南京网络赛A题 The beautiful values of the palace https://nanti.jisuanke.com/t/41298 Here is a square matrix of n * nn∗n, each lattice has its value (nn must be odd), and the center value is n * nn∗n. Its spiral decline along the center of the squar…
Walk Through Squares Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 200    Accepted Submission(s): 57 Problem Description   On the beaming day of 60th anniversary of NJUST, as a military colleg…
Divide Groups Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 423    Accepted Submission(s): 161 Problem Description   This year is the 60th anniversary of NJUST, and to make the celebration mor…
Count The Pairs Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 277    Accepted Submission(s): 150 Problem Description   With the 60th anniversary celebration of Nanjing University of Science…
目录 题目链接 题意 思路 代码 题目链接 传送门 题意 初始时你有\(n\)张牌(按顺序摆放),每一次操作你将顶端的牌拿出,然后按顺序将上面的\(m\)张牌放到底部. 思路 首先我们发下拿走\(1\)后就变成了总共有\(n-1\)个人数到\(m+1\)的人出局,问你每个人是第几个出局的,很明显的约瑟夫环. 比赛的时候我还在推公式,然后发现机房有人用暴力模拟过了,尤其是题解也是暴力,就很无语. 如果这题标程不假并且只给\(1s\),那么该怎么写呢? 这题由于\(n\)很大,我们肯定不能将\(n\…
题目链接 2019.9.2更新 第二天睡醒想了想发现好像搜一遍就可以过,赛时写的花里胡哨的还错了,太菜了QAQ #include<bits/stdc++.h> using namespace std; typedef long long ll; ; struct node { int s, e, next; }edge[maxn]; int head[maxn], len; void init() { memset(head, -, sizeof(head)); len = ; } void…