2018ICPC南京Problem G. Pyramid】的更多相关文章

题意: 询问类似于这样的三角形中:里面正三角形的个数是多少. 思路:打表找了个规律发现就是C4n+3     1 //#include<bits/stdc++.h> 2 #include<time.h> 3 #include <set> 4 #include <map> 5 #include <stack> 6 #include <cmath> 7 #include <queue> 8 #include <cstdi…
题意: 数一个金字塔里面有多少个正三角形. 题解: ans[n]=n*(n-1)*(n-2)*(n-3)/24 #include<bits/stdc++.h> using namespace std; typedef long long ll; ; )/; int main() { long long i,j,k,n,m,t; scanf("%lld",&t); while(t--) { scanf("%lld",&n); ll ans=…
题意: 找有多少个等边三角形 解析: 首先打标找规律,然后对式子求差分 0,1,5,15,35,70,126,210... 1,4,10,20,35,56... 3,6,10,15,21... 3,4,5,6,7... 1,1,1,1... 0,0,0... 得到前n项的和为0C1n+1+1C2n+1+3C3n+1+3C4n+1+1C5n+1 解得:第n项为n(n+1)(n+2)(n+3)/24(因为要取模,所以要求24得逆元) 代码: #include <algorithm> #includ…
题目: 题意:给出一个序列a1,⋯,ana1,⋯,an.fac(l,r)fac(l,r)为mul(l,r)mul(l,r)中不同质因数的个数. 请计算:                 ∑i=1n∑j=infac(l,r) 思路:求质因数的贡献度,我们可以定义一个二维vector pos[i][k]=p表示当前质因数i在p位置出现k次那么该因子的贡献度为(n-p+1)*p,            因为可能会重复计算的,那么我们只要减去上一个位置出现i的情况,那么每一个质因子的贡献度为(n-pos…
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)\…
想要输出""的话: cout<<"A person whose name is \""<<name<<"\" and age is "<<age<<" is created!"<<endl; Home Web Board ProblemSet Standing Status Statistics   Problem G: 克隆人来了!…
这个题目主要是乘法运算符的重载,卡了我好久,矩阵的乘法用3个嵌套的for循环进行,要分清楚矩阵的乘法结果是第一个矩阵的行,第二个矩阵的列所组成的矩阵. 重载+,*运算符时,可以在参数列表中传两个矩阵引用,分别表示前后进行运算的矩阵,或者是只传运算符之后的矩阵引用,前一个矩阵用的是隐含的this指针指向的矩阵.我用的是后者. Home Web Board ProblemSet Standing Status Statistics   Problem G: 强悍的矩阵运算来了 Problem G:…
Problem G: Check The Check Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 10  Solved: 3[Submit][Status][Web Board] Description Your task is to write a program that reads a chessboard configuration and identifies whether a king is under attack (in chec…
Problem G Good Teacher I want to be a good teacher, so at least I need to remember all the student names. However, there are too many students, so I failed. It is a shame, so I don't want my students to know this. Whenever I need to call someone, I c…
Problem G Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 16   Accepted Submission(s) : 5 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description There are Y lines parallel t…