摘要: https://www.acwing.com/problem/content/852/ https://www.luogu.com.cn/problem/P3371 https://www.luogu.com.cn/problem/P4779 #include <cstring> #include 阅读全文
posted @ 2021-03-12 22:57 瓜子NEW-G 阅读(48) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1467 A 有n个灯,每个灯一开始都是0,每一秒钟每个灯显示的数字会往上一位,但是由于每个灯只能显示单个数位,所以从9增大时得到的是0.在任意时刻,你可以指定唯一一个灯被停止,下一秒后,他相邻的两个灯也会进入暂停状态.问,在合理的设置一 阅读全文
posted @ 2021-02-07 22:22 瓜子NEW-G 阅读(79) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1473 A 题意:一个数组,可以用两个不同的元素替换掉另外一个元素,不限次数。问,能否使得数组中所有元素都不大于 d 。 思路:显然,如果所有元素都不大于d,那就执行0次。成立。如果有元素大于d,那就得替换掉,显然选择最小的两个元素进行 阅读全文
posted @ 2021-01-28 06:27 瓜子NEW-G 阅读(45) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1474 A√ 题意:现有两个长度为n的0,1字符串a,b(其中仅包含0,1),对两个字符串相加得到字符串c(按数值不进位相加);例如:a=“011011”;b=“101101”;则c=“112112”;之后将c中的连续重复数字替换为一位 阅读全文
posted @ 2021-01-27 22:36 瓜子NEW-G 阅读(69) 评论(0) 推荐(0)
摘要: 关于(n,m)找正方形长方形问题 正方形 边长为1的正方形个数为n*m 边长为2的正方形个数为(n-1)*(m-1) 边长为3的正方形为个数(n-2)*(m-2) 边长为min(n,m)的正方形为个数s1=(n-min(n,m)+1)*(m-min(n,m)+1) 然后从边长为1到min(m,m)的 阅读全文
posted @ 2020-11-05 11:13 瓜子NEW-G 阅读(73) 评论(0) 推荐(0)
摘要: A Problem Statement Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations requir 阅读全文
posted @ 2020-10-28 16:06 瓜子NEW-G 阅读(369) 评论(0) 推荐(0)
摘要: C++中几个输入函数的用法和区别 cin、cin.get()、cin.getline()、getline()、gets()、getchar() 1、cin1、cin.get()2、cin.getline()3、getline()4、gets()5、getchar() 1、cin>> 用法1:最基本, 阅读全文
posted @ 2020-10-22 22:15 瓜子NEW-G 阅读(2918) 评论(0) 推荐(0)
摘要: 关于质数埃及筛和线性筛介绍一下埃及筛 #include<bits/stdc++.h>#define maxn 1000010#define ll long longusing namespace std;int prime[maxn];bool is_prime[maxn];int sieve(in 阅读全文
posted @ 2020-10-18 23:02 瓜子NEW-G 阅读(333) 评论(0) 推荐(0)
摘要: 关于快速排序和归并排序 #include <bits/stdc++.h> using namespace std; void quick_sort(int q[], int l, int r){ if (l >= r) return; int i = l - 1, j = r + 1, x = q[ 阅读全文
posted @ 2020-10-17 14:20 瓜子NEW-G 阅读(45) 评论(0) 推荐(0)