ICode9

精准搜索请尝试: 精确搜索
  • cf1366 D. Two Divisors2022-04-19 02:00:19

    题意: 找 x 的两个大于 1 的因子 d1 和 d2,使得 \(\gcd(d1+d2,x)=1\) 思路: 性质:\(\gcd(a,b)=\gcd(a+b,b)\) 所以, \(\gcd (x,y)=1=\gcd(x+y,x)=\gcd(x+y,y)\implies \gcd(x+y,xy)=1\) 找 x 的最小素因子和它的次数 \(p^k\),答案是 \(p^k,x/p^k\)

  • CF 1366D. Two Divisors(线性筛)2021-11-04 22:02:56

    #include <cstdio> #include <cstring> #include <cmath> #include <ctime> #include <cassert> #include <algorithm> #include <random> #include <chrono> #include <iostream> #include <functional> #incl

  • 「题解」[CF1537D] Deleting Divisors2021-07-31 11:31:50

    显然这种题我们可以打个表来帮助我们思考问题。 枚举 \(i\) 的每一个非 \(1\) 和 \(i\) 的因数 \(j\),判断 \(i-j\) 是否为必败态,若是,则 \(i\) 为必胜态;反之 \(i\) 为必败态。 可以采用复杂度为 \(\Theta(n\sqrt{n})\) 的代码进行打表: /* I will never forget it. */ // 39269

  • D.Deleting Divisors(博弈)2021-07-13 20:00:57

    题目大意:Alice和Bob玩游戏,Alice先手,每一次他们都要做操作就是将数减去它的因子(他小于自身且不为1的因子) 轮到谁不能做这个操作谁就输了。所以他们会尽力给对方留下质数 链接: https://codeforces.com/problemset/problem/1537/D. #include<bits/stdc++.h> using namespace st

  • [codeforces 1366D] Two Divisors2020-06-18 16:51:30

    题意 \(d_1, d_2\)是 a 的因子, 找到 gcd(\(d_ 1 + d_2\), a) = 1 题解 gcd(x, y) = gcd(x + y, y) = gcd(x, y + x) = gcd(x, \(y^n\)) = gcd(\(x^n\), y) = gcd(x + y, x * y) = 1; 证明: 辗转相除法的逆用 gcd(x, y) = gcd(x - y, y) = gcd(x + y, y) 没啥区别 设 x = ky + r

  • Codeforces1355F Guess Divisors Count2020-05-23 17:08:18

    Description link 交互题 要求猜一个正整数 \(X(X\le 10^9)\) 每次可以给出一个 \(Q\) 会从交互库里得到 \(gcd(X,Q)\) 在不超过 \(22\) 次询问里面求出 \(X\) 的个数 容错机制: 设输出为 \(out\) 则满足一下之一即可 \(1.\frac 1 2\le\frac{out}{ans}\le 2\) \(2.|ans-out|\le 7\)

  • D. Almost All Divisors(数学分解因子)2020-05-02 11:06:26

    其实这题并不难啊,但是分解因子的细节一定要小心。 \(比如样例48,2是因子说明24也是因子,也就是说假如x存在\) \(那么x一定是因子中的最小数乘上最大数\) \(那我们现在去验证x是否存在,先拿x去整除除数表,看看是否所有除数都是x的因子\) \(然后再去判断x的因子个数是不是等于n(确保除

  • 【11.4测试】divisors2019-11-04 16:50:52

    题目描述给定m 个不同的正整数a1,a2,.... am,请对0 到m 每一个k 计算,在区间[1, n] 里有多少正整数 是a 中恰好k 个数的约数。   输入第一行包含两个正整数n,m,分别表示区间范围以及a 数组的大小。 第二行包含m 个不同的正整数a1,a2,.... am,表示a 数组。   输出输出m + 1 行,每行一

  • cf1203C C. Common Divisors2019-10-30 20:53:56

    问题分析 gcd + 优化 (一个数的因数至少有一半小于等于 sqrt(这个因数) AC代码如下: #include<iostream> #include<cstring> #include<cmath> #include<set> using namespace std; const int maxn=4e5+3; long long num[maxn] ; set<long long > number; long long gcd(lon

  • CF1203C Common Divisors2019-10-30 20:50:32

    You are given an array aa consisting of nn integers. Your task is to say the number of such positive integers xx such that xx divides eachnumber from the array. In other words, you have to find the number of common divisors of all elements in the arr

  • UPC13522 Favourite Number2019-10-18 12:50:40

    Favourite Number 时间限制: 1 Sec  内存限制: 128 MB提交: 6  解决: 4[提交] [状态] [命题人:admin] 题目描述 Volodymyr’s favourite number is A and it has an odd number of positive divisors. When you add K to this number, the resulting sum also has an od

  • D. Yaroslav and Divisors顺序统计+树状数组2019-09-09 15:40:07

    题意: 给你一组nnn个数字,这些数字是1 n1~n1 n的一个排列。现在有很多个询问,询问给定一个区间,问区间内有多少个整除对。 思路: 设sum[i]sum[i]sum[i]为从1到i的所有整除对数量。对于区间[l,r][l,r][l,r],我们知道,区间[l,r][l,r][l,r]的整除对数量是sum[r]−sum[l−1]sum[r]-s

  • Codeforces 1203C Common Divisors(gcd)2019-08-14 18:53:50

    题目链接:https://codeforces.com/problemset/problem/1203/C 求给定数列所有数的公因数个数 没什么好说的,其实就是求所有数最大公因数的因数个数。div2上分div3掉分,丢人说的就是我吧。教训就是大数的因数很多所以能少算一点是一点,别的花里胡哨的操作没有这个方便而且省的多。 代码

  • Problem 212019-06-16 14:02:49

    Problem 21 https://projecteuler.net/problem=21 Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and

  • Almost All Divisors(求因子个数及思维)2019-05-15 15:41:06

    ---恢复内容开始--- We guessed some integer number xx. You are given a list of almost all its divisors. Almost all means that there are all divisors except 11and xx in the list. Your task is to find the minimum possible integer xx that can be t

  • DIVCNT2&&3 - Counting Divisors2019-03-09 21:37:57

    DIVCNT2 - Counting Divisors (square)  DIVCNT3 - Counting Divisors (cube)  杜教筛 [学习笔记]杜教筛 (其实不算是杜教筛,类似杜教筛的复杂度分析而已) 你要大力推式子: 把约数个数代换了 把2^质因子个数 代换了 构造出卷积,然后大于n^(2/3)还要搞出约数个数的式子和无完全平方数的

  • Divisors CodeForces - 1033D(数论)2019-03-02 18:55:10

    Divisors CodeForces - 1033D(数论) 题目大意 给出n个数,每个数有3到5个因数,问n个数的积有多少因数 解题思路 由于每个数有3-5个因子,在除去了数本身之外就只有这个几种情况 三个因子:为完全平方数 四个因子:为完全三次方数,或为两个不同的素数的乘积 五个因子:为完全四次方数

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有