摘要:
这道题就是二分答案,但是要尤其注意0,在写check的环节要对0进行特殊对待,以及最后的结果进行特殊判断,详见代码 AC代码 #include <iostream> using namespace std; typedef long long ll; const int N = 1e5+5; ll 阅读全文
摘要:
一道简简单单的小贪心,注意不能sort,每次减右边的,第一个糖果特判 AC代码 #include <iostream> using namespace std; typedef long long ll; const int N = 1e5 + 5; int a[N]; ll ans = 0; in 阅读全文
摘要:
遍历正方形边长,然后遍历左上角的坐标,计算以这个左上角作为左上角的正方形中的所有值之和,然后和正方形边长的平方看看是否相等,不相等就不是 AC代码 #include <algorithm> #include <iostream> using namespace std; const int N = 阅读全文