06 2022 档案

摘要:思路: 经观察,可发现答案2,因为两个数nn1可以筛到所有数。 依次枚举每个小标的倍数即可 代码: #include <iostream> using namespace std; int n; char ch; string s; int main () { int T; c 阅读全文
posted @ 2022-06-28 20:19 incra 阅读(30) 评论(0) 推荐(0) 编辑
摘要:思路: 依题意模拟即可,注意等号。 代码: #include <iostream> #include <algorithm> using namespace std; const int N = 1010; int n,m; int a[N],b[N]; int main () { cin >> n 阅读全文
posted @ 2022-06-26 13:37 incra 阅读(4) 评论(0) 推荐(0) 编辑
摘要:首先,我们可以用 2101024 的复杂度暴搜,然后再来判断当前这种情况的结束时刻。 现在我们通过爆搜获得了一个长度为 1010 的由 01 组成的字符串。然后维护两个数组 abai维护的是 i 队在当前时刻进球数量之后最多进球的数量,bi 阅读全文
posted @ 2022-06-26 10:56 incra 阅读(49) 评论(0) 推荐(0) 编辑
摘要:思维: 我们可以发现,nice stairs的长度为1,3,7,15... 不难发现,长度变化每次2+1,而每次长度的nice stairs是等差数列,所以当长度为n时,一共有n(n+1)2个正方形 #include <iostream> using namespace std 阅读全文
posted @ 2022-06-19 10:50 incra 阅读(19) 评论(0) 推荐(0) 编辑
摘要:模拟: 依题意模拟即可。 别忘了把数组开大来! #include <iostream> using namespace std; const int N = 100010; int n; int a[N]; int main () { cin >> n; for (int i = 1;i <= n; 阅读全文
posted @ 2022-06-19 09:59 incra 阅读(20) 评论(0) 推荐(0) 编辑
摘要:BFS: 暴力枚举所有情况即可 #include <iostream> #include <queue> using namespace std; int n; string s; string bfs () { queue <string> q; for (int i = 0;i < 26;i++ 阅读全文
posted @ 2022-06-19 09:45 incra 阅读(37) 评论(0) 推荐(0) 编辑
摘要:暴力: 依题意暴力枚举即可 #include <iostream> #include <algorithm> using namespace std; const int N = 1030; int n; int a[N],b[N]; int main () { int T; cin >> T; w 阅读全文
posted @ 2022-06-19 09:04 incra 阅读(24) 评论(0) 推荐(0) 编辑
摘要:并查集: 思路:把所有x或y相同的点合并成一个集合,所需要加的点数就是连通块数量-1。 #include <iostream> using namespace std; const int N = 110; int n; int x[N],y[N],p[N]; int find (int x) { 阅读全文
posted @ 2022-06-19 07:42 incra 阅读(29) 评论(0) 推荐(0) 编辑
摘要:暴力: 暴力枚举所有人即可 数据有误,第三行应该是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 阅读(22) 评论(0) 推荐(0) 编辑
摘要:位运算: 用在[0,2n]的每一个数来枚举所有情况,如果i >> j & 1 == 1,那么就要往右转,否则要往左转。 #include <iostream> #include <cstring> #include <algorithm> using namespace std; cons 阅读全文
posted @ 2022-06-18 12:48 incra 阅读(23) 评论(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 阅读(18) 评论(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 阅读(25) 评论(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 阅读(8) 评论(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 阅读(117) 评论(0) 推荐(0) 编辑
摘要:暴力枚举即可 当min_digit(x)==0时,答案就不会更新了,就可以直接退出并输出答案了 #include <iostream> using namespace std; typedef long long LL; LL a,k; int main () { int T; cin >> T; 阅读全文
posted @ 2022-06-18 07:29 incra 阅读(15) 评论(0) 推荐(0) 编辑
摘要:一定要记得排序! #include <iostream> #include <algorithm> using namespace std; const int N = 60; int n; int a[N]; int main () { int T; cin >> T; while (T--) { 阅读全文
posted @ 2022-06-18 07:16 incra 阅读(15) 评论(0) 推荐(0) 编辑
摘要:记得odd,even在每组数据记得初始化位0 #include <iostream> using namespace std; int n,m; int main () { int T; cin >> T; while (T--) { int odd = 0,even = 0; cin >> n > 阅读全文
posted @ 2022-06-17 19:15 incra 阅读(23) 评论(0) 推荐(0) 编辑
摘要:直接暴力枚举左右两端点即可 #include <iostream> using namespace std; const int N = 110; int n; int a[N],b[N]; int main () { cin >> n; for (int i = 1;i <= n;i++) cin 阅读全文
posted @ 2022-06-17 18:35 incra 阅读(14) 评论(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 阅读(30) 评论(0) 推荐(0) 编辑
摘要:一定要记得开long long! 一定要记得开long long! 一定要记得开long long! 题目 题意 给你一系列糖果,每个糖果有一个起始的价值 ai ,我们每天都会获得k元,不可积累,每种糖果每天只能买一个,每天,所有糖果都会涨价1元,问最多能买到多少糖果? #include <iost 阅读全文
posted @ 2022-06-16 19:42 incra 阅读(15) 评论(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 阅读(24) 评论(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 阅读(32) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示