南京网络赛J-Sum【数论】】的更多相关文章

题意: 统计每个数的因子的对数,如果因子能被某个平方数整除,则不统计在内,每对因子有序 解析: 我们对某个数n进行质因子分解,如果某个质因子的指数大于2则 f(n) = 0, 例 N = X3 * M = R * T 因为要分成两部分 所以无论怎样分 R 或 T 总有一部分X的指数大于等于2 如果指数为2 则只能是R 和 T 两部分每个部分有一个X,所以只有一种情况,贡献为1 如果指数为1 则这个X可以在R 和 T的任意一部分 ,所以有两种情况 #include <iostream> #inc…
A square-free integer is an integer which is indivisible by any square number except 11. For example, 6 = 2 \cdot 36=2⋅3 is square-free, but 12 = 2^2 \cdot 312=22⋅3 is not, because 2^222 is a square number. Some integers could be decomposed into prod…
传送门:https://nanti.jisuanke.com/t/A1958 题意:n个点m条边的路,你有k次机会将某条路上的边权变为0,问你最短路径长度 题解:最短路变形,我们需要在常规的最短路上多开 一维,记录,我消耗j次机会时的最短路径长度为多少 代码: /** * ┏┓ ┏┓ * ┏┛┗━━━━━━━┛┗━━━┓ * ┃ ┃ * ┃ ━ ┃ * ┃ > < ┃ * ┃ ┃ * ┃... ⌒ ... ┃ * ┃ ┃ * ┗━┓ ┏━┛ * ┃ ┃ Code is far away fro…
2018ICPC南京网络赛 A. An Olympian Math Problem 题目描述:求\(\sum_{i=1}^{n} i\times i! \%n\) solution \[(n-1) \times (n-1)! \% n= (n-2)!(n^2-2n+1) \%n =(n-2)!\] \[(n-2+1)\times (n-2)! \% n= (n-3)!(n^2-3n+2) \%n =(n-3)! \times 2\] 以此类推,最终只剩下\(n-1\) 时间复杂度:\(O(1)\…
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…
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…
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…
南京网络赛自闭现场 https://nanti.jisuanke.com/t/41298 二维偏序经典题型 二维前缀和!!! #include<bits/stdc++.h> using namespace std; #define int long long #define sc(x) scanf("%lld",&x); int T; #define P pair<int,int> #define fi first #define se second #…
luogu 1327 数列排序 题意 给定一个数列\(\{an\}\),这个数列满足\(ai≠aj(i≠j)\),现在要求你把这个数列从小到大排序,每次允许你交换其中任意一对数,请问最少需要几次交换? 思路 找循环节.答案即为 (循环节的长度\(-1\)) 对所有循环节求和. 如果只能交换相邻两个,那么就是求逆序对个数.因为交换相邻两个数字的效果是使逆序对个数\(-1\). Code #include <bits/stdc++.h> #define maxn 100010 using name…