ICode9

精准搜索请尝试: 精确搜索
  • Leetcode第306场周赛(附数位DP总结)2022-10-17 21:10:59

    1、矩阵中的局部最大值&ensp;&ensp;简单题,n&times;n的矩阵,最后得到(n-2)&times;(n-2)的矩阵,做法就是枚举每个起点。class Solution { public: int find_max(vector<vector<int>>& grid,int start_i,int start_j){ int num_max = 0;

  • Acwing 第 66 场周赛 A-C2022-08-27 22:03:15

    2A,来晚 + 中间有事,第三题没写,但是写第三题的时候也感觉犯迷糊,读懂题意就好了 A AcWing 4606. 奇偶判断 题意:判断末位是偶数还是奇数 跳过   B AcWing 4607. 字母补全 题意:一段包含问号的字符序列,可以将问号改为任何字符,使一段长度为26的区间包括['A','Z']之间的所有字符 挨个遍历

  • acwing第65场周赛2022-08-21 22:01:29

    1.最大价值 原题链接:https://www.acwing.com/problem/content/4606/ 思路 经典双指针 代码: #include<iostream> #include<algorithm> #include<cstring> using namespace std; int main() { int n; cin >> n; while(n --) { int slen;

  • AcWing周赛62-64 中比较有意思的小题题解2022-08-14 18:30:43

    AcWing周赛62-64(选讲) 感觉比较思维 4502. 集合操作 https://www.acwing.com/problem/content/4505/ 根据题意,肯定要使得所取的最大值最大,平均值最小。又因为每次放进来的的数字都是递增的,所以最大值必然取的是最新放入的那个 \(x\), 接下来考虑平均值,要使平均值尽可能小的话,就要保

  • Acwing 第 64 场周赛 C 4507. 子数组异或和(异或+前缀和)2022-08-14 11:03:39

    https://www.acwing.com/problem/content/4510/ 给定一个长度为 n 的整数数组 a1,a2,…,an。 请你统计一共有多少个数组 a 的非空连续子数组能够同时满足以下所有条件: 该连续子数组的长度为偶数。 该连续子数组的前一半元素的异或和等于其后一半元素的异或和。 输出 一个整数,表

  • 【AcWing】第 62 场周赛2022-07-31 16:00:09

    周赛传送门 4500. 三个元素 本题可以学习的地方: 1.用map来存值和下标,map会自动排序 2.输出map中的元素可以先用vector存起来,然后输出vector中的元素 #include <iostream> #include <map> #include <vector> using namespace std; int n; map<int, int> pos; int main() { s

  • AcWing 第59场周赛2022-07-10 00:00:40

    AcWing 第59场周赛 https://www.acwing.com/activity/content/competition/problem_list/2015/ AcWing 4491. 数组操作 按题意模拟即可 注意小坑:前缀和包括第0项,多一个答案0 #include <bits/stdc++.h> using namespace std; int main () { int minn = 0, ans = 0, sum = 0;

  • Leetcode第300场周赛记录2022-07-03 19:02:44

    6108. 解密消息 题目分析:给定key 和 message,其中key中26个英文小写字母首次出现的顺序作为替换表中的字母顺序,听起来有点绕口,如:"the quick..."对应"abc defgh...",即key首次出现的字母按字母表顺序映射,因此直接用哈希表模拟,将message的每个字母替换,' '不变。 class Solution {

  • [LeetCode周赛复盘] 第 299 场周赛202206262022-06-27 00:04:09

    @目录一、本周周赛总结二、 [Easy] 6101. 判断矩阵是否是一个 X 矩阵1. 题目描述2. 思路分析3. 代码实现三、[Medium] 6100. 统计放置房子的方式数1. 题目描述2. 思路分析3. 代码实现四、[Hard] 5229. 拼接数组的最大分数1. 题目描述2. 思路分析3. 代码实现五、[Hard] 6103. 从树

  • 第 298 场周赛2022-06-19 23:35:23

        暴力解决 1 class Solution: 2 def greatestLetter(self, s: str) -> str: 3 a=[0]*66 4 b=[0]*66 5 # str=input() 6 7 for ch in s: 8 if ch.isupper(): 9 a[ord(ch)-ord("A")]

  • AcWing杯 - 第56场周赛2022-06-18 21:01:05

    比赛链接 第 56 场周赛 先放代码,题解慢慢补 A AcWing 4482. 分组 #include<bits/stdc++.h> using namespace std; const int N=105; int n; int a[N]; int main() { cin>>n; int ans=0; for(int i=1;i<=n;i++) { int x; cin>>x;

  • 6.132022-06-13 20:31:22

    暑假正式开始了,之前就算给自己小小的放了个假吧,下面是对自己的要求 暑假学习: 训练: ①基本的学校训练---补题在第二天的早上 ②cf--补题在第二天的下傍晚 ③acw每日一题和周赛---补题在当时(周赛啥时候出来啥时候补,不能拖延) 学习新知识: ①提高课+算法进阶指南+紫书搭配起来看,主要看

  • acwing周赛502022-05-15 15:33:49

    题目链接 1.缺少的数 模拟 \(O(n)\) 可以使用桶排序,将未出现的字母输出即可 时间复杂度 遍历一次O(n) C++代码 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 1e5 + 10; int n; int num[N]; int main() { cin >> n;

  • acwing周赛512022-05-15 15:32:33

    题目链接 1.上车 算法(暴力枚举) \(O(n)\) 只需要判断出车辆空余是否大于二即可 时间复杂度 暴力一遍即可,复杂度位\(O(n)\) C++ 代码 #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N = 1e5 + 10; int n, m, k; int main() { cin.t

  • 【leetcode】291 周赛2022-05-01 19:00:06

    T1 6047. 移除指定数字得到的最大结果 给你一个表示某个正整数的字符串 number 和一个字符 digit 。 从 number 中 恰好 移除 一个 等于 digit 的字符后,找出并返回按 十进制 表示 最大 的结果字符串。生成的测试用例满足 digit 在 number 中出现至少一次。 思路 将字符串转化列

  • 力扣第290场周赛T3T42022-04-24 13:01:15

    t3.统计包含每个点的矩阵数目 题意 给定一些矩阵和一些点,计算每个点被多少个矩阵包含着 思路 题目中矩阵的高度范围是1~100,因此,将每个高度对应的矩阵宽度存下来,排序。枚举每个点,每个点枚举高度比它大的,然后在每个高度中二分宽度,找到第一个大于点的宽度。 找到每个高度有多少个矩阵

  • AcWing第24场周赛题解2022-04-20 12:32:29

    A. 4070. 异或 题目链接:https://www.acwing.com/problem/content/4073/ 题目大意:略。 解题思路:简单模拟。 示例程序: #include <bits/stdc++.h> using namespace std; int n, a[11], res; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i];

  • AcWing第23场周赛题解2022-04-20 10:00:14

    A. 4003. 完全平方数 题目链接:https://www.acwing.com/problem/content/4006/ 题目大意:求 \(n\) 个数中最大的非完全平方数。 解题思路:循环一遍即可。 示例程序: #include <bits/stdc++.h> using namespace std; bool check(int a) { if (a < 0) return false; int b = sq

  • AcWing第15场周赛题解2022-04-11 16:01:08

    A. 3826. 青蛙跳 题目链接:https://www.acwing.com/problem/content/3829/ 题目大意:略。 解题思路:简单数学题。 示例程序: #include <bits/stdc++.h> using namespace std; int T; long long a, b, k; int main() { cin >> T; while (T--) { cin >> a >> b &

  • AcWing第12场周赛题解2022-04-10 21:04:20

    A. 3803. 数组去重 题目链接:https://www.acwing.com/problem/content/3806/ 题目大意:给数组去重,相同数字输出最右边一个。 解题思路:开一个 set 从右往左判断是否第一个出现,用 vis[] 数组标记是否要输出。 示例程序: #include <bits/stdc++.h> using namespace std; int T, n, a[55]

  • Acwing第 46 场周赛2022-04-10 19:34:13

    第2题:AcWing 4397. 卡牌 卡住的点:不用具体实现翻牌、记录编号的操作,只需求d[i]=b[i]-a[i],之后将d排序,当d[i]>0时,不选,反之则选。 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 200010; int n, m; int a[N], b[N], d[N]; i

  • AcWing第11场周赛题解2022-04-10 08:32:03

    A. 3795. 计算abc 题目链接:https://www.acwing.com/problem/content/3798/ 题目大意:已知三个正整数 \(a \le b \le c\),告诉你 \(a+b,a+c,b+c,a+b+c\),分别求 \(a,b,c\)。 解题思路:比较简单所以直接看代码吧。 示例程序: #include <bits/stdc++.h> using namespace std; int a[4]; i

  • AcWing第10场周赛题解2022-04-09 11:33:15

    A. 3787. 整除 题目链接:https://www.acwing.com/problem/content/3790/ 题目大意:a 加几次 1 能够被 b 整除。 解题思路:如果 a % b == 0,则 0 次;否则,b - a % b 次。不用 if 的话用 (b - a % b) % b 也可以。 示例程序: #include <bits/stdc++.h> using namespace std; int T, a, b;

  • AcWing第8场周赛题解2022-04-09 02:31:27

    A. 3770. 最小消耗 题目链接:https://www.acwing.com/problem/content/description/3773/ 题目大意:按照题目要求消灭两种类型怪兽(可以消耗 c 转换)的最小消耗。 解题思路:循环记录 0 和 1 出现的次数,消灭一个 0 的最小消耗为 min(a, b+c),消灭一个 1 的最小消耗为 min(a+c, b)。 示例

  • AcWing第6场周赛题解2022-04-08 09:03:56

    A. AcWing 3733. 去掉一个元素 题目链接:https://www.acwing.com/problem/content/3736/ 题目大意:问共有多少个元素满足,在去掉该元素后,剩余元素的相加之和为一个偶数(注意,0 也算偶数)。 解题思路:若和为奇数,答案为奇数个数;若和为偶数,答案为偶数个数。 示例程序: #include <bits/stdc++.

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有