摘要: 002 模拟+找规律 规律就是上面正三角第i行是i*2-1个符号 正三角的符号数为t,整个沙漏的符号数为t*2-1 #include <bits/stdc++.h> using namespace std; int n , m , t = 0; char ch; int main() { cin > 阅读全文
posted @ 2022-03-02 20:23 PHarr 阅读(38) 评论(0) 推荐(0) 编辑
摘要: B2142 求 1+2+3+...+N 的值 就是用高斯公式 #include <bits/stdc++.h> using namespace std; int n; int main() { cin >> n; cout << (n+1)*n/2 << endl; } B2112 石头剪子布 没有 阅读全文
posted @ 2022-03-02 20:19 PHarr 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Day1-4 AcWing 1843. 圆形牛棚 数据范围很小直接枚举起点就好 #include <bits/stdc++.h> using namespace std; const int N = 1005; int n , a[N] , res = 0x7f7f7f7f; int main() 阅读全文
posted @ 2022-02-20 21:53 PHarr 阅读(52) 评论(0) 推荐(0) 编辑
摘要: # 一个简单的Java程序 ```cpp public class testcode { public static void main(String[] args) { System.out.println("Hello,Word!"); } } ``` 这就是一个简单的`Hello,Word!` 阅读全文
posted @ 2022-02-20 19:43 PHarr 阅读(194) 评论(0) 推荐(0) 编辑
摘要: Day1 AcWing 1913.公平摄影 首先我们考虑全是H或G的情况其实很简单就是遍历就好 然后就是把H赋值为1,G赋值为 -1,然后做前缀和若s[l]==s[r]则证明[l+1,r]中的H,G是一样多的,因为我们要找最长的我们只要保存s[i]每个值第一次出现的位置就行,剩下就是数据范围比较大需 阅读全文
posted @ 2022-02-13 19:52 PHarr 阅读(31) 评论(0) 推荐(0) 编辑
摘要: Day1 今天除夕,比较懒 牛客2022年除夕AK场 很可惜没能ak A 如意 利用PHP直接水 1 B 烟花 一道很常见的模拟 #include<bits/stdc++.h> using namespace std; int n; int main() { cin >> n; for( int i 阅读全文
posted @ 2022-02-13 16:34 PHarr 阅读(26) 评论(0) 推荐(0) 编辑
摘要: Day1,2 22牛客寒假训练营1 E 炸鸡块君的高中回忆 因为不论怎么操作,前面的几次最多带入m-1,最后一次最多可以带入m 所以我们就能得到一个式子$k(m-1)+m\ge n$,化简这个式子就能得到$k\ge \frac{n-m}{m-1}$ 所以答案就是$2k+1$次,然后只需解这个不等式即 阅读全文
posted @ 2022-01-30 22:46 PHarr 阅读(57) 评论(0) 推荐(0) 编辑
摘要: Day 1 - Day5 AcWing 2014. 岛 首先要对每个点进行离散化,然后对于相邻的相同高度的点进行去重,然后按照高度排序,并枚举每一个点 对于每个点有三种情况 两侧都比中间高,淹没该点后小岛数+1 两侧都比中间低,淹没该点后小岛数-1 两侧一高一低,淹没该点后小岛数不变 虽然去重后相邻 阅读全文
posted @ 2022-01-23 21:18 PHarr 阅读(28) 评论(0) 推荐(0) 编辑
摘要: Day 1 AcWing 2041. 干草堆 简单的前缀和,加上一点点读入优化 int main() { n = read() , k = read(); for( int i = 1 , l , r ; i <= k ; i ++ ) { l = read() , r = read(); a[ l 阅读全文
posted @ 2022-01-16 20:38 PHarr 阅读(39) 评论(0) 推荐(0) 编辑
摘要: A AtCoder Quiz 3 大于42加一即可 #include<bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n , fa[N]; int main() { cin >> n; cout << "AGC"; if( 阅读全文
posted @ 2021-12-06 16:45 PHarr 阅读(139) 评论(0) 推荐(0) 编辑