上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 31 下一页
摘要: A. Cowardly Rooks 在$n\times n$的棋盘中有 m 个车,问是否可以在移动任意一个棋子一步后是的m个车不能相互攻击 如果m>n无论如何都会冲突 首先要统计冲突的数量 如果没有冲突的话,如果n==m则移动后一定会导致冲突,反之一定可以 如果只有一个冲突,就一定可以把冲突解决 如 阅读全文
posted @ 2023-01-08 15:01 PHarr 阅读(12) 评论(0) 推荐(0) 编辑
摘要: Day 1 One Bamboo Contest Round #10 Day 2 One Bamboo Contest Round #11(Clone from 2022 ICPC Manila) Day 3 CF580C 一棵以1为根的树,树上有些点是红的。一个叶子是合法的当且仅当从根到它的路径上 阅读全文
posted @ 2023-01-02 14:34 PHarr 阅读(89) 评论(0) 推荐(0) 编辑
摘要: # **6-1 二叉树的遍历** 就是简单的遍历 ```cpp void InorderTraversal( BinTree BT ){ if( BT == NULL ) return; if( BT->Left != NULL ) InorderTraversal( BT->Left ); pri 阅读全文
posted @ 2022-11-26 17:25 PHarr 阅读(50) 评论(0) 推荐(0) 编辑
摘要: A. Medium Number #include<bits/stdc++.h> using namespace std; int read(){ int x = 0 , f = 1 , ch = getchar(); while( (ch < '0' || ch > '9') && ch != ' 阅读全文
posted @ 2022-11-22 15:28 PHarr 阅读(118) 评论(0) 推荐(0) 编辑
摘要: # 游乐园 因为套票更加便宜,根据贪心应该尽可能的选择套票。 #include<bits/stdc++.h> using namespace std; int main(){ int x , y; cin >> x >> y; cout << 60 * x + 40 * y - 10 * min( 阅读全文
posted @ 2022-11-14 19:24 PHarr 阅读(31) 评论(0) 推荐(0) 编辑
摘要: A sum 把所有的数放进一个大根堆,然后每次取出最大的两个相加,累加到答案中去,并重新放回到大根堆。 最大两数之和重新放入大根堆依旧是最大的数,所以可以优化成前缀和来做。 #include<bits/stdc++.h> #define int long long using namespace s 阅读全文
posted @ 2022-11-10 10:49 PHarr 阅读(14) 评论(0) 推荐(0) 编辑
摘要: A 至至子的等差中项 #include<bits/stdc++.h> using namespace std; int32_t main(){ int a , b; cin >> a >> b; cout << b * 2 - a << "\n"; } B 至至子的按位与 如果在二进制下按位考虑。如 阅读全文
posted @ 2022-11-10 10:39 PHarr 阅读(13) 评论(0) 推荐(0) 编辑
摘要: A. Sum 找到最大值即可 #include<bits/stdc++.h> using namespace std; int read(){ int x = 0 , f = 1 , ch = getchar(); while( (ch < '0' || ch > '9') && ch != '-' 阅读全文
posted @ 2022-11-08 16:59 PHarr 阅读(20) 评论(0) 推荐(0) 编辑
摘要: A - Find Takahashi 找到序列中最高的数存在的位置 #include<bits/stdc++.h> using namespace std; int read() { int x = 0, f = 1, ch = getchar(); while ((ch < '0' || ch > 阅读全文
posted @ 2022-11-08 13:15 PHarr 阅读(37) 评论(0) 推荐(0) 编辑
摘要: A - Rightmost #include<bits/stdc++.h> using namespace std; int32_t main() { string s; cin >> s; for( int i = s.size() ; i >= 1 ; i -- ) if( s[i-1] == 阅读全文
posted @ 2022-11-07 21:51 PHarr 阅读(33) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 31 下一页