数学
文章平均质量分 78
C_z_Q
ACM Retired
展开
-
ZOJ1199Point of Intersection【公式推导】
点击打开链接 #include using namespace std; int getdis(int a,int b,int c,int d){ return (a-c)*(a-c)+(b-d)*(b-d); } int main(){ int t,x1,y1,r1,x2,y2,r2; scanf("%d",&t); while(t--){ scanf("%d%d%d",&x1,原创 2016-04-24 16:37:44 · 458 阅读 · 0 评论 -
HDU 6030 Happy Necklace[找规律][矩阵快速幂]
题意:问一个长度为n,由R和B构成字符串,在每个斐波那契长度的子串中,R的个数不少于B。 分析:直接搞不知道怎么搞,然后就手动打了打表,,打到了8,找了一个多小时= =。 最后发现规律是 a[n] = a[n - 1] + a[n - 3]; 因为n有1e18,所以还需要矩阵快速幂加个速。 以下是代码: #include #include #include #includ原创 2017-05-08 10:06:52 · 327 阅读 · 0 评论