随笔分类 -  AtCoder之路

摘要:B - Extended ABC 必须是以abc的大小拼起来才是符合的 #include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int n=s.size(); for(int i=1;i<n;i++){ i 阅读全文
posted @ 2024-02-03 22:27 yufan1102 阅读(36) 评论(0) 推荐(0)
摘要:A #include<bits/stdc++.h> using namespace std; void solve(){ string s; cin>>s; for(int i=0;i<s.size()-1;i++){ cout<<s[i]; } cout<<"4"; } int main(){ i 阅读全文
posted @ 2024-01-07 23:01 yufan1102 阅读(35) 评论(0) 推荐(0)
摘要:A. Rating Increase 字符串处理 #include<bits/stdc++.h> using namespace std; void solve(){ string s; cin>>s; int n=s.size(); s=" "+s; for(int i=1;i<=n-1;i++) 阅读全文
posted @ 2023-12-20 22:04 yufan1102 阅读(27) 评论(0) 推荐(0)
摘要:C - Error Correction 大意是:给定一个字符串a,以及一组字符串,如果字符串与a满足以下之一即可 我写的有点麻烦。。 #include<bits/stdc++.h> using namespace std; void solve(){ int n; cin>>n; string s 阅读全文
posted @ 2023-12-18 21:58 yufan1102 阅读(21) 评论(0) 推荐(0)
摘要:C - T-shirts 题意是:给定一个string,字符代表每天有不同的事,做不同的事会穿不同的衣服,问你最少需要准备多少T恤。 思路:贪心,能不用T恤就不要T恤 #include<bits/stdc++.h> using namespace std; void solve(){ int n,k 阅读全文
posted @ 2023-12-17 13:43 yufan1102 阅读(43) 评论(0) 推荐(0)
摘要:C - Sensors 但看数据发现是经典油田问题,直接dfs #include<bits/stdc++.h> using namespace std; int n,m; int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0}; int dy[8] = {-1, 0, 1, 阅读全文
posted @ 2023-12-17 13:40 yufan1102 阅读(26) 评论(0) 推荐(0)
摘要:C - Sum of Numbers Greater Than Me 题意:给定一个长度为n的数组,分别找出比a[i]大的数组里的数的和 思路:用map记录每个数的个数,然后遍历一遍,后面一个项就是数组之和-前面一项-前面的累加 #define int long long using namespa 阅读全文
posted @ 2023-12-09 10:00 yufan1102 阅读(48) 评论(0) 推荐(0)
摘要:B - Bombs 题意:就是说有一种炸弹,能炸曼哈顿距离的障碍物,要你打印出炸完后的图 模拟 #include<bits/stdc++.h> using namespace std; char mp[50][50]; void solve(){ int n,m; cin>>n>>m; for(in 阅读全文
posted @ 2023-12-03 16:35 yufan1102 阅读(32) 评论(0) 推荐(0)
摘要:B - 326-like Numbers 题意:找到一个不小于n的数是326数,定义是 思路:简单的模拟循环即可 #include<bits/stdc++.h> using namespace std; bool check(int x){ vector<int>a; while(x){ a.pus 阅读全文
posted @ 2023-12-03 16:01 yufan1102 阅读(34) 评论(0) 推荐(0)
摘要:B - Minimize Abs 1 思维题 题意:给定一个范围,你选择一个数,使得 思路:如果A[i]在l,r中间,那么直接打印就行,如果不是就打印就近的 using namespace std; void solve(){ int n,l,r; cin>>n>>l>>r; for(int i=1 阅读全文
posted @ 2023-11-27 14:58 yufan1102 阅读(44) 评论(0) 推荐(0)
摘要:C - Count xxx 题意是:给你一个字符串,求出字符串里面相同字母的子串数量 思路:用map映射即可,取每个字母的最大长度,然后加起来 using namespace std; int main(){ int n; string s; cin>>n>>s; map<char,int>mp; 阅读全文
posted @ 2023-11-21 13:20 yufan1102 阅读(38) 评论(0) 推荐(0)
摘要:B - 11/11 题意是:有n个月份,要你计算出月份上的每个数位与对应月份中的每个日期数位一致的日期和 直接模拟即可 using namespace std; int a[200]; int p; bool check(int x){ p=x%10; x/=10; while(x){ int q= 阅读全文
posted @ 2023-11-18 15:29 yufan1102 阅读(50) 评论(0) 推荐(0)
摘要:A - ab 题意:判断字符串中是否有“ab”或者是“ba“ #include<bits/stdc++.h> using namespace std; void solve(){ int n; cin>>n; string s; cin>>s; if(s.find("ab")!=s.npos||s. 阅读全文
posted @ 2023-11-06 23:29 yufan1102 阅读(30) 评论(0) 推荐(0)