Divisible

[Codeforces] CF1744E1 Divisible Numbers (easy version)

CF1744E1 Divisible Numbers (easy version) 题意 给你四个数 \(a,b,c,d\),你需要找出一组 \(x,y\) 使得 \(a<x\leq c,b<y\leq d\) 并且 \(x\cdot y\) 能被 \(a\cdot b\) 整除,如果没有输出 -1 ......
Codeforces Divisible Numbers version 1744E

[ARC141D] Non-divisible Set 题解

题目链接 点击打开链接 题目解法 很思维的题,需要用好所有的特殊性质 暴力的做法是建出图,然后求包含点 \(i\) 的最长反链,但这明显过不了 上面的做法没用到 \(a_i<2m\) 的性质 如何用?把 \(a_i\) 拆分成 \(q\times 2^k\;(k\) 为奇数\()\) 的形式,那么对 ......
题解 Non-divisible divisible 141D ARC

Codeforces Round 748 (Div. 3) B. Make it Divisible by 25

给一个正整数 \(n\) ,在一步操作中可以移除 \(n\) 中的一个。当 \(n\) 只剩下一位时将不能再操作,如果过程中产生了前导 \(0\) ,则会被自动移除且不耗费操作次数。 询问最少需要多少次操作可以使得 \(n\) 被 \(25\) 整除。 显然一个正整数 \(x\) 若可以被 \(25 ......
Codeforces Divisible Round Make 748

题解 ARC141D【Non-divisible Set】

这个题不是网络流。 problem 我们说一个集合 \(D\) 是一个好的集合,当不存在集合中的两个不同元素 \(a,b\) 使得 \(a\) 是 \(b\) 的约数。 给定 \(N\) 个整数的一个集合 \(S\),值域均落在 \([1, 2*M]\) 内。 对 \(S\) 中的每个元素 \(A_ ......
题解 Non-divisible divisible 141D ARC

1476A - K-divisible Sum

## A. K-divisible Sum https://codeforces.com/problemset/problem/1476/A ```python """ 思路: 1.k >= n, 如果能除尽, 就是每项都相同肯定是最小的, 比如2 6, 3是最小的, 其他的肯定比3要大, 所以只要 ......
K-divisible divisible 1476A 1476 Sum

每日一题力扣 1262 https://leetcode.cn/problems/greatest-sum-divisible-by-three/

、 题解 这道题目核心就算是要知道如果x%3=2的话,应该要去拿%3=1的数字,这样子才能满足%3=0 贪心 sum不够%3的时候,就减去余数为1的或者余数为2的 需要注意 两个余数为1会变成余数为2的,所以可能减去2个余数为1 核心代码如下 public int maxSumDivThreeOth ......

[LeetCode] 1262. Greatest Sum Divisible by Three

Given an integer array nums, return the maximum possible sum of elements of the array such that it is divisible by three. Example 1: Input: nums = [3, ......
Divisible LeetCode Greatest Three 1262

Divisible Numbers

#include<iostream> #include<math.h> #include<string> #include<algorithm> using namespace std; typedef long long ll; const int N=1e5+10; int n; ll gcd( ......
Divisible Numbers

ARC141D Non-divisible Set

ARC141D Non-divisible Set 这题还是比较有启发性的。 经典的偏序关系下最长反链,第一反应是转化为最小链覆盖,但是在很多以整数的整除关系为背景的题目中这个做法不是最好的。 洛谷的题意翻译中少给了一个信息:值域为 $[1,2M]$。这个条件看上去就应该和选 $M$ 个数的限制结合 ......
Non-divisible divisible 141D ARC 141
共9篇  :1/1页 首页上一页1下一页尾页