摘要:
暴力: 暴力枚举所有人即可 数据有误,第三行应该是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)

浙公网安备 33010602011771号