随笔分类 - 我的比赛
-
Codeforces Round 993 (Div. 4)
摘要:https://codeforces.com/contest/2044 A. Easy Problem 签到题。对于大小为n的矩阵,有n-1个a>0&&b>0的(a,b)pair,满足b=n-a。 #include <iostream> #include <map> #include <string 阅读全文
-
蓝桥 小白入门赛24
摘要:https://www.lanqiao.cn/oj-contest/newbie-24/ 1. 分配辣条 签到题。 #include <iostream> using namespace std; int main() { cout<<20250601/305*305; return 0; } Vi 阅读全文
-
AcWing cup 2022春季
摘要:A:水题。 链接:https://www.acwing.com/problem/content/4379/ 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 #include <map> 5 using names 阅读全文
-
AcWing周赛 40
摘要:A:签到题,直接模拟即可 题目地址:https://www.acwing.com/problem/content/4308/ 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 #include <set> 5 6 阅读全文
-
Codeforces Round #739
摘要:A:水题,预处理一下符合题目要求的数即可。 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 #include<queue> 5 #include<unordered_map> 6 using namespace 阅读全文
-
leetcode周赛 248
摘要:A:模拟题。 1 class Solution { 2 public: 3 vector<int> buildArray(vector<int>& nums) { 4 int n=nums.size(); 5 vector<int> ans(n); 6 for(int i=0;i<n;i++){ 7 阅读全文
-
AcWing周赛 6
摘要:A:水题。 https://www.acwing.com/problem/content/3736/ 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 const in 阅读全文
-
AcWing周赛 5
摘要:A:水题。 https://www.acwing.com/problem/content/3729/ 1 #include<iostream> 2 using namespace std; 3 const int N=110; 4 int w[N]; 5 int main() 6 { 7 int T 阅读全文
-
数据结构--线段树
摘要:线段树的基本思想是分治。 此处的是简单线段树,即只支持单点修改,区间查询,不涉及懒标记。 树的每一个节点维护一个区间 [ l , r ] 的值,其子节点的区间的并集等于这个区间的值,左儿子维护[l , mid] ,右儿子维护[ mid+1 , r ]。 树的高度为log(n),所以更新操作的时间复杂 阅读全文
-
leetcode周赛 243
摘要:A:水题。 https://leetcode-cn.com/problems/check-if-word-equals-summation-of-two-words/ 1 class Solution { 2 public: 3 int tans(string s){ 4 int res=0; 5 阅读全文
-
AcWing周赛 1
摘要:A:水题。 给定两个数组,找到从这俩数组中各找一数,使得和不在任何一个数组中。 因为数组中的数都是正整数,最大的俩数相加必然不在这俩数组之中。 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using name 阅读全文
-
leetcode周赛 242
摘要:A:水题,给定01串,问连续的0更长还是连续的1更长。 直接遍历即可。 1 class Solution { 2 public: 3 bool checkZeroOnes(string s) { 4 int res1=0,res0=0; 5 int cnt1=0,cnt0=0; 6 for(int 阅读全文
-
AcWing第二次热身赛
摘要:A:水题,找到不小于n的能够被4整除的最小的数。 假设n不能被4整除,那么n+1,n+2,n+3之中一定存在一个数能够被4整除。所以直接枚举即可。 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using na 阅读全文
-
leetcode周赛 241
摘要:A:水题,直接暴搜就好了。 1 class Solution { 2 public: 3 int res; 4 void dfs(vector<int>&nums,int i,int sum){ 5 if(i==nums.size()){ 6 res+=sum; 7 return ; 8 } 9 d 阅读全文
-
第十二届蓝桥杯C++ B组
摘要:A:计算256MB能够存放多少个int 1 int main() 2 { 3 cout<<256*1024*1024/4; 4 return 0; 5 } ans=67108864 B:计算2021张1到10的卡片能够拼出1~n的最大的n 1 int cnt[10]; 2 int main() 3 阅读全文
-
leetcode周赛 239
摘要:A:水题,直接枚举即可。 1 class Solution { 2 public: 3 int getMinDistance(vector<int>& nums, int target, int start) { 4 int res=0,seq=INT_MAX; 5 for(int i=0;i<nu 阅读全文
-
leetcode周赛 238
摘要:A:水题 1 class Solution { 2 public: 3 int sumBase(int n, int k) { 4 int res=0; 5 while(n){ 6 res+=n%k; 7 n/=k; 8 } 9 return res; 10 } 11 }; B:给定一个数组和一个可 阅读全文
-
Codeforces Round #713
摘要:又是该LL用int了,什么时候才能不犯病啊。 A:水题,让你找出3个以上的数组中不同的那个数 我是直接分情况。 1 #include<iostream> 2 #include<vector> 3 using namespace std; 4 const int N=110; 5 int a[N]; 阅读全文
-
leetcode周赛 233
摘要:A:水题,数据范围较小,直接暴力模拟。 1 class Solution { 2 public: 3 bool check(vector<int> a,int i,int j ){ 4 for(int k=i+1;k<=j;k++){ 5 if(a[k]<=a[k-1]){ 6 return fal 阅读全文
-
牛客 小白月赛32
摘要:A:枚举所有可能的情况,判断能否组成两个三角形。 1 #include<iostream> 2 #include<vector> 3 using namespace std; 4 bool three_one(int a){ 5 int cnt0=0,cnt1=0; 6 for(int i=0;i< 阅读全文