随笔分类 -  数论

摘要:链接:https://ac.nowcoder.com/acm/contest/392/C 来源:牛客网 华华给月月出题 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 华华刚刚帮月月完成了作 阅读全文
posted @ 2019-08-27 21:09 茄子Min 阅读(281) 评论(0) 推荐(0)
摘要:链接:https://ac.nowcoder.com/acm/contest/634/C 来源:牛客网 题目描述 给出一个区间[L,R],求出[L,R]中孪生质数有多少对。 由于这是一个区间筛质数的模板题。所以小k不屑于去写。 所以出题人只好yy了另一道题。 定义k生互质数为满足y + k与y k互 阅读全文
posted @ 2019-08-13 21:49 茄子Min 阅读(263) 评论(0) 推荐(0)
摘要:wls 有一个整数 n,他想将 1 − n 这 n 个数字分成两组,每一组至少有一个数,并且使得两组数字的和的最大公约数最大,请输出最大的最大公约数。 Input 输入一行一个整数 n。 2 ≤ n ≤ 1, 000, 000, 000 Output 输出一行一个整数表示答案。 Sample Inp 阅读全文
posted @ 2019-08-03 01:55 茄子Min 阅读(485) 评论(0) 推荐(0)
摘要:链接:https://ac.nowcoder.com/acm/contest/82/A来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 时间限制:C/C++ 1秒,其他语言2秒 空间限制: 阅读全文
posted @ 2019-06-01 00:38 茄子Min 阅读(310) 评论(0) 推荐(0)
摘要:蒜头君有n个数,他想要从中选出k个数,使得它们的最大公约数最大。请你求出这个最大的最大公约数。 输入格式第一行输入两个整数 。第二行输入 个整数 。 输出格式输出一个整数。 数据范围 样例输入14 32 4 8 3样例输出12 样例输入24 24 8 6 6样例输出16 思路: 因为每一个a[i]  阅读全文
posted @ 2019-05-23 21:44 茄子Min 阅读(243) 评论(0) 推荐(0)
摘要:链接:https://ac.nowcoder.com/acm/contest/897/M来源:牛客网 LCM LCM 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 Silly Slp know 阅读全文
posted @ 2019-05-23 00:54 茄子Min 阅读(288) 评论(0) 推荐(0)
摘要:Let’s play a game.We add numbers 1,2...n in increasing order from 1 and put them into some sets. When we add i,we must create a new set, and put iinto 阅读全文
posted @ 2019-04-27 22:35 茄子Min 阅读(315) 评论(0) 推荐(0)
摘要:Arkady and his friends love playing checkers on an n×nn×n field. The rows and the columns of the field are enumerated from 11 to nn. The friends have 阅读全文
posted @ 2019-04-20 21:09 茄子Min 阅读(338) 评论(0) 推荐(0)
摘要:给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量: 1. 1≤a≤n,1≤b≤m; 2. a×b 是 2016 的倍数。 Input 输入包含不超过 30 组数据。 每组数据包含两个整数 n,m (1≤n,m≤10 9). Output对于每组数据,输出一个整数表示满足条件的数 阅读全文
posted @ 2019-04-09 19:53 茄子Min 阅读(280) 评论(0) 推荐(0)
摘要:Problem Statement You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. Constraints 1≤N≤10^3 Input The input is g 阅读全文
posted @ 2019-03-17 15:35 茄子Min 阅读(795) 评论(0) 推荐(0)
摘要:题目描述: AS WE ALL KNOW, lfx是咱们组的神仙,但是mxh想考一考lfx一个简单的问题,以此看一下lfx到底是不是神仙。但是lfx要准备补考,于是请你来帮忙回答问题: 给定一个整数N,和N个整数ai(1<=i<=n),mxh有n个询问,即第i个询问(1<=i<=n)是数组a从1~i 阅读全文
posted @ 2019-02-17 23:51 茄子Min 阅读(253) 评论(0) 推荐(0)
摘要:escription Lfx在复习离散的时候突然想到了一个算法题,毕竟是lfx, 算法题如下: 他想知道这样的问题,先定义1~n中即是3的倍数,又是11的倍数的那些数的和sum, 他想知道sum有多少个质因子,以及1~sum-1中有多少个数与sum互质? 1<= N <= 1e6 输入: 一个整数n 阅读全文
posted @ 2019-02-17 23:36 茄子Min 阅读(252) 评论(0) 推荐(0)
摘要:Recently you have received two positive integer numbers xx and yy. You forgot them, but you remembered a shuffled list containing all divisors of xx ( 阅读全文
posted @ 2019-01-24 12:20 茄子Min 阅读(708) 评论(0) 推荐(0)
摘要:You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have b 阅读全文
posted @ 2019-01-15 15:39 茄子Min 阅读(426) 评论(0) 推荐(0)
摘要:Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers. For exampl 阅读全文
posted @ 2019-01-11 21:01 茄子Min 阅读(327) 评论(0) 推荐(0)
摘要:C. Maximal GCD time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output C. Maximal GCD time limit 阅读全文
posted @ 2019-01-08 21:33 茄子Min 阅读(274) 评论(0) 推荐(0)
摘要:题目链接 比较棒的一道题, 题意: 给你一个N个数的数组,让你用尽量少的操作使整个数组的gcd大于1,即gcd(a1 ,a2,,,,an) > 1 如果可以输出YES和最小的次数,否则输出NO 首先我们来看一下这个操作, 如果对 a b 老两个数进行操作 第一次为 a-b a+b 第二次为 -2b 阅读全文
posted @ 2019-01-06 21:51 茄子Min 阅读(234) 评论(0) 推荐(0)