摘要: 思路:虽然看到题目就想到了用欧拉函数做,但就是不知道怎么做...当a b互质时GCD(a,b)= 1,由此我们可以推出GCD(k*a,k*b)= k。设ans[i]是1~i-1与i的GCD之和,所以最终答案是将ans[0]一直加到ans[n]。当 k*i==j 时,a... 阅读全文
posted @ 2018-04-05 16:02 KirinSB 阅读(121) 评论(0) 推荐(0) 编辑
摘要: You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = ... 阅读全文
posted @ 2018-04-05 10:24 KirinSB 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer... 阅读全文
posted @ 2018-04-03 22:27 KirinSB 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Harmonic NumberIn mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers:In this problem, y... 阅读全文
posted @ 2018-04-02 21:29 KirinSB 阅读(177) 评论(0) 推荐(0) 编辑
摘要: Pairs Forming LCMFind the result of the following code:long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i #i... 阅读全文
posted @ 2018-04-02 12:53 KirinSB 阅读(386) 评论(0) 推荐(0) 编辑
摘要: Goldbach`s Conjecture Goldbach's conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It stat... 阅读全文
posted @ 2018-04-01 14:45 KirinSB 阅读(490) 评论(0) 推荐(0) 编辑
摘要: Leading and Trailing You are given two integers: n and k, your task is to find the most significant three digits, and least significan... 阅读全文
posted @ 2018-04-01 13:55 KirinSB 阅读(990) 评论(0) 推荐(0) 编辑
摘要: 题意:一个有向图。第一问:最少给几个点信息能让所有点都收到信息。第二问:最少加几个边能实现在任意点放信息就能传遍所有点思路:把所有强连通分量缩成一点,然后判断各个点的入度和出度tarjan算法:问问神奇海螺啥是tarjan代码:#include#include#inc... 阅读全文
posted @ 2018-03-29 22:20 KirinSB 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 题意:给一个矩形(非正方形)面积a和最小边长b,要求边长均大于b,求这样的矩形有几个思路:先用到了之前学的质因数分解,还有一个新的公式:然后我们可以先算出a的所有约数,因为只算约数个数面积重复,所以要/2;然后暴力出#include#include#include#i... 阅读全文
posted @ 2018-03-27 13:10 KirinSB 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Bi-shoe and Phi-shoeBamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his su... 阅读全文
posted @ 2018-03-25 17:18 KirinSB 阅读(472) 评论(0) 推荐(0) 编辑