LP102 2019 SpringHomework 1AbstractWrite a C [1] program that can play the games of Go and GoBan.1 Introduction of Go and GobanGo (called WeiQi in Chi ...
分类:
编程语言 时间:
2019-04-19 20:09:40
阅读次数:
154
思路 将题意转化为$\sum_{i = 1}^{n} \sum_{j = 1}^{i - 1}gcd(i, j)$,考虑每个最大公因数的值$k$对答案的影响。假设 $gcd(A,B) = k$ 那么肯定可以表示成 $gcd(ak,bk) = k$ $gcd(a, b) = 1$ 假设$a>b$那么$ ...
分类:
其他好文 时间:
2019-04-17 19:38:16
阅读次数:
221
1、有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子对数为多少? 解决思路:递归方法解决,兔子的规律为数列1,1,2,3,5,8,13,21... 程序运行结果: 2、判断101-200之间有多少个素数,并输出所有素数。 我的代 ...
分类:
编程语言 时间:
2019-04-14 18:12:18
阅读次数:
182
#include #define ll long long using namespace std; const int maxn=1e7+10; int vis[maxn]; int mu[maxn]; int prime[maxn]; int tot=0; int sum1[maxn]; int... ...
分类:
其他好文 时间:
2019-04-14 12:28:06
阅读次数:
122
弱鸡准备校赛的时候看了一下最简单的筛法求素数: 开一个bool数组 奇数为true 偶数为false 因为偶数肯定不是素数嘛 然后遍历 如果a[i]==true 就把所有的i的倍数全设为 false 如此遍历到 sqrt(n)就将所有的小于n的素数全部筛出来了 代码: 在此基础上优化的算法是 只存奇 ...
分类:
其他好文 时间:
2019-04-13 00:47:42
阅读次数:
127
从数组中选择几个数,要求他们的乘积可以开平方,问有多少种方案。 先将单个数拆分成质因子,对于这个数而言,那些指数为奇数的质因子会使这个数无法被开平方。 所以我们需要选择一个对应质因子指数为奇数的元素,将他们两个放在一个方案中,但是又有可能会引入其他的质因子。 这样就变成了求解行列式中自由变元的数量问 ...
分类:
其他好文 时间:
2019-04-10 23:18:14
阅读次数:
159
一、谓词与谓词公式 谓词:表示个体词性质或相互之间关系的词 量词:用来表示个体数量的词是 谓词的量化:给谓词加上量词 一元目谓词P(x)、n元目谓词P(x, y, z, ...)它们是命题形式而非命题 因为既没有指定谓词符号P的含义,而且个体词x、y等也是个体变项而不代表某个具体的事物,从而无法确定 ...
分类:
其他好文 时间:
2019-04-09 23:25:10
阅读次数:
707
Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7 ...
分类:
其他好文 时间:
2019-04-08 01:00:01
阅读次数:
189
482. Binary Tree Level Sum Given a binary tree and an integer which is the depth of the target level. Calculate the sum of the nodes in the target lev ...
分类:
其他好文 时间:
2019-04-06 14:13:23
阅读次数:
117
Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less tha ...
分类:
其他好文 时间:
2019-04-06 09:24:43
阅读次数:
107