随笔分类 -  比赛

摘要:第 91 场双周赛#1 不同的平均值数目 不同的平均值数目 ##Solution class Solution { public: int distinctAverages(vector<int>& nums) { sort(nums.begin(),nums.end()); int i = 0,j = nums.s 阅读全文
posted @ 2023-01-16 23:52 HM-W 阅读(32) 评论(0) 推荐(0)
摘要:第 319 场周赛1 温度转换 温度转换 Solution class Solution { public: vector<double> convertTemperature(double celsius) { double kelvin = celsius + 273.15; double fahrenheit 阅读全文
posted @ 2023-01-12 22:18 HM-W 阅读(50) 评论(0) 推荐(1)
摘要:第 320 场周赛#1.数组中不等三元组的数目 数组中不等三元组的数目 ##Solution class Solution { public: int unequalTriplets(vector<int>& nums) { int n = nums.size(); int cnt = 0; for(int i = 阅读全文
posted @ 2023-01-10 23:36 HM-W 阅读(28) 评论(0) 推荐(0)
摘要:第 95 场双周赛#1.根据规则将箱子分类 根据规则将箱子分类 ##Solution class Solution { public: string categorizeBox(int length, int width, int height, int mass) { long long w = 1e4, v = 阅读全文
posted @ 2023-01-10 00:47 HM-W 阅读(22) 评论(0) 推荐(0)
摘要:第 92 场双周赛#1.分割圆的最少切割次数 分割圆的最少切割次数 ##Solution class Solution { public: int numberOfCuts(int n) { int tmp = 360 / n; if(n == 1) return 0; if(n % 2 == 0) return n 阅读全文
posted @ 2023-01-07 23:45 HM-W 阅读(41) 评论(0) 推荐(0)
摘要:第 321 场周赛#1.找出中枢整数 找出中枢整数 Solution class Solution { public: int pivotInteger(int n) { int sum = (1 + n)* n / 2; int tmp = (int)sqrt(sum); return tmp * tmp == s 阅读全文
posted @ 2023-01-06 23:52 HM-W 阅读(23) 评论(0) 推荐(0)
摘要:LeetCode第 322 场周赛#1.回环句 回环句 Solution class Solution { public: bool isCircularSentence(string sentence) { int n = sentence.size(), i = 0; if (sentence[0] != sentence[n 阅读全文
posted @ 2023-01-06 00:00 HM-W 阅读(48) 评论(0) 推荐(0)
摘要:第 93 场双周赛#1.数组中字符串的最大值 数组中字符串的最大值 Solution class Solution { public: int maximumValue(vector<string>& strs) { int ans = -1; for(auto x : strs){ int n = x.size() 阅读全文
posted @ 2023-01-04 00:00 HM-W 阅读(32) 评论(0) 推荐(0)
摘要:第 324 场周赛#1.统计相似字符串对的数目 统计相似字符串对的数目 Solution class Solution { public: int similarPairs(vector<string>& words) { unordered_map<int,int> book; int len1 = words.s 阅读全文
posted @ 2023-01-02 19:56 HM-W 阅读(36) 评论(0) 推荐(0)
摘要:第 326 场周赛1.统计能整除数字的位数 统计能整除数字的位数 Solution class Solution { public: int countDigits(int num) { int ans = 0; int n = num; while(n){ int t = n % 10; if(num % t == 阅读全文
posted @ 2023-01-01 22:06 HM-W 阅读(34) 评论(0) 推荐(0)
摘要:UNIQUE VISION Programming Contest 2022 Winter(AtCoder Beginner Contest 283)A - Power Given integers A and B, print the value A^B. 基础不解答 B - First Query Problem 基础不解答 C - Cash Register Takahashi is a cashier. There is a cash r 阅读全文
posted @ 2022-12-31 20:01 HM-W 阅读(84) 评论(0) 推荐(0)
摘要:LeetCode第 94 场双周赛1.最多可以摧毁的敌人城堡数目 题目 最多可以摧毁的敌人城堡数目 Solution 可以第一重循环找到$1$,然后从该位置分别向左和向又寻找$-1$,寻找过程中遇到$1$则停止,不更新ans,遇到$-1$则更新ans。 class Solution { public: int captureFort 阅读全文
posted @ 2022-12-31 19:39 HM-W 阅读(35) 评论(0) 推荐(0)
摘要:LeetCode周赛3251.到目标字符串的最短距离 题目 Solution class Solution { public: int closetTarget(vector<string>& words, string target, int startIndex) { int n = words.size(); int 阅读全文
posted @ 2022-12-31 15:59 HM-W 阅读(28) 评论(0) 推荐(0)