摘要: UPDATE update(2024/12/10) : 修正了E题代码的小错误,十分感谢 @Andyqian7 提供的hack数据! update(2024/12/15) : 修正了B题题解中存在问题的表述,十分感谢 @iy88 指出这个问题! 概述 本次重现赛已经上传到SYNU OJ,本校的同学可 阅读全文
posted @ 2024-12-09 14:46 橙之夏 阅读(3382) 评论(7) 推荐(2)
摘要: A. 早餐 print("39.20") B. 水论文 #define int long long signed main() { int n,k; cin >> n >> k; set<int> st; int ans = 0; st.insert(n); for(int i = 0, t = n 阅读全文
posted @ 2024-10-24 18:20 橙之夏 阅读(283) 评论(0) 推荐(1)
摘要: A. 左移 #include<bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while(T--) { string s; cin >> s; int ans = -1; if(s.front() == s.back 阅读全文
posted @ 2024-10-20 21:26 橙之夏 阅读(177) 评论(0) 推荐(0)
摘要: A. Orange的作文排版 关于处理若干行输入,我们可以用while结合getline函数来完成,每次读取一行,就让行数+1,然后每次利用string的size方法得到当前行的列数,更新最长的列,最后得到答案。 #include<bits/stdc++.h> using namespace std 阅读全文
posted @ 2024-10-14 09:16 橙之夏 阅读(162) 评论(0) 推荐(0)
摘要: 处理一行输入 C++的cin和C语言的scanf函数都以空格为分隔符,读取输入,每次读到空格或者换行符就会停止。因此,当我们要输出的一整行包含空格时,以上函数均无法得到正确的结果。 string s; cin >> s; cout << s; 输入: hello world 输出: hello 为了 阅读全文
posted @ 2024-10-14 08:32 橙之夏 阅读(78) 评论(0) 推荐(0)
摘要: A.字符串拼接 直接拼接两个字符串即可,注意的是字符串可能包含空格,因此需要使用getline函数进行输入。 #include <bits/stdc++.h> using namespace std; int main() { string s1, s2; getline(cin, s1); get 阅读全文
posted @ 2024-10-10 14:05 橙之夏 阅读(520) 评论(0) 推荐(0)
摘要: 2024 秋季PAT认证甲级(题解A-D) 写在前面 这一次PAT甲级应该是最近几次最简单的一次了,3个小时的比赛差不多30分钟就ak了(也是拿下了整场比赛的rk1),下面是题解报告,每个题目差不多都是20-30行代码,难度在洛谷普及组左右(cf 1000-1200分) A. A-1 Happy P 阅读全文
posted @ 2024-09-03 23:06 橙之夏 阅读(819) 评论(0) 推荐(0)
摘要: 类 - 链式前向星(封装) by 橙之夏 Code struct forstar { vector<int> _h, _e, _ne, _w; int idx = 0; forstar(int n) // 初始化,n为容量 { _h.resize(n + 1, -1), _e.resize(n + 阅读全文
posted @ 2024-03-06 20:01 橙之夏 阅读(37) 评论(0) 推荐(0)
摘要: 代码宏定义以及框架约定 #include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // #define int long long #d 阅读全文
posted @ 2024-01-31 22:28 橙之夏 阅读(179) 评论(0) 推荐(0)
摘要: Codeforces Round 916 (Div. 3) (A~E2) A. Problemsolving Log 签到题,对于给出的字符串,用数组记录每个字母出现的次数,然后遍历一边记录数组,如果对应的字母出现次数大于它的位次,则说明该字母对应的题目被解出来了,最后输出解题数量即可 void s 阅读全文
posted @ 2023-12-20 01:27 橙之夏 阅读(444) 评论(0) 推荐(0)