上一页 1 ··· 14 15 16 17 18
摘要: 暴力: 暴力枚举所有人即可 数据有误,第三行应该是2 1,害我调半天 #include <iostream> #include <vector> #include <set> using namespace std; const int N = 100010; int n; set <int> an 阅读全文
posted @ 2022-06-18 14:14 incra 阅读(29) 评论(0) 推荐(0)
摘要: 位运算: 用在$[0,2^n]$的每一个数来枚举所有情况,如果$i >> j & 1 == 1$,那么就要往右转,否则要往左转。 #include <iostream> #include <cstring> #include <algorithm> using namespace std; cons 阅读全文
posted @ 2022-06-18 12:48 incra 阅读(33) 评论(0) 推荐(0)
摘要: 贪心: 先将所有数选出最小和最大的5个数,再按绝对值大小枚举选数字 #include <iostream> #include <algorithm> using namespace std; typedef long long LL; const int N = 100010; int n; int 阅读全文
posted @ 2022-06-18 12:31 incra 阅读(27) 评论(0) 推荐(0)
摘要: 因为是 a[i] * a[j] ,然后这里是根据a[i]来找a[j],可以知道i+j一定是a[i]的倍数,i是不变的,所以j的增加量一定是a[i]的倍数。其中j = a[i]-i对应的是a[j] = 1,j = a[i]对应的是a[j] = 2,以此类推。 #include <iostream> u 阅读全文
posted @ 2022-06-18 12:06 incra 阅读(38) 评论(0) 推荐(0)
摘要: 先求出最小的整数公差,再求出第一项,最后求整个等差数列 #include <iostream> using namespace std; int n,x,y; int main () { int T; cin >> T; while (T--) { cin >> n >> x >> y; int t 阅读全文
posted @ 2022-06-18 09:59 incra 阅读(14) 评论(0) 推荐(0)
摘要: 当总和不是x的倍数时,答案就是n;当数组里所有数是x的倍数时,答案是-1;否则从两侧一直往中间收缩,答案就是max (n-l,r-1) #include <iostream> using namespace std; const int N = 100010; int n,x,sum; int a[ 阅读全文
posted @ 2022-06-18 09:12 incra 阅读(129) 评论(0) 推荐(0)
摘要: B. Madoka and the Elegant Gift 简单翻译: 有n * m个格子,格子的值要么是1,要么是0。 值为1的格子可以组成一些矩阵,如果某个矩阵A被包含在矩阵B之内,那么A就是B的一个子集 如果一个矩阵不被包含在其他任何矩阵之内,这个矩阵就是nice的 如果所有的格子中,nic 阅读全文
posted @ 2022-06-16 22:30 incra 阅读(40) 评论(0) 推荐(0)
摘要: 一定要记得开long long! 一定要记得开long long! 一定要记得开long long! 题目 题意 给你一系列糖果,每个糖果有一个起始的价值 ai ,我们每天都会获得k元,不可积累,每种糖果每天只能买一个,每天,所有糖果都会涨价1元,问最多能买到多少糖果? #include <iost 阅读全文
posted @ 2022-06-16 19:42 incra 阅读(26) 评论(0) 推荐(0)
摘要: You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers. Consider a number a 阅读全文
posted @ 2022-06-16 10:06 incra 阅读(40) 评论(0) 推荐(0)
摘要: You are given a positive integer nn. Let's call some positive integer aa without leading zeroes palindromic if it remains the same after reversing the 阅读全文
posted @ 2022-06-16 10:06 incra 阅读(53) 评论(0) 推荐(0)
上一页 1 ··· 14 15 16 17 18