ICode9

精准搜索请尝试: 精确搜索
  • 2022.9.7 模拟2022-09-07 09:02:53

    挂了点分,原因如下: r = mid - 1 ;mid = (l + r) / 2; Unknown TLE (本地测没有超过0.7s) 反正题不难。 T3一眼原题,其实现做也会,就是缩点后的拓扑 dp 。 然后做 T2,T2读了题的前几行:线段树区间覆盖,一看数据:我是傻逼。 然后开始想乱搞,但是都不太靠谱,然后我忽然发现这题可以二分,于是就

  • CF1615F LEGOndary Grandmaster2022-07-31 18:36:17

    written on 2022-05-05 洛谷题目传送门 第一次看到这类题目,显然丝毫没有下手之处。但其实这是一道套路题,这道题就用来总结经验好了。 原题操作:把相邻两个 \(0\) 变成 \(1\) 或把相邻两个 \(1\) 变成 \(0\) 。定义 \(s\) 到 \(t\) 的距离为 最少操作次数 使得 \(s\) 变成 \(t\) ,如

  • 牛客华为机试HJ1002022-04-23 09:05:34

    原题传送门 1. 题目描述 2. Solution import sys def solve(n): a1 = 2 d = 3 print(a1 * n + n * (n - 1) * d // 2) for line in sys.stdin: n = int(line.strip()) solve(n)

  • 牛客华为机试HJ1062022-04-23 09:03:19

    原题传送门 1. 题目描述 2. Solution import sys for line in sys.stdin: s = line.strip() print(s[::-1])

  • 牛客华为机试HJ842022-04-22 07:35:19

    原题传送门 1. 题目描述 2. Solution import sys def solve(s): cnt = 0 for c in s: if c.isupper(): cnt += 1 print(cnt) for line in sys.stdin: s = line.strip() solve(s)

  • 牛客华为机试HJ722022-04-22 07:02:17

    原题传送门 1. 问题描述 2. Solution print("0 25 75") print("4 18 78") print("8 11 81") print("12 4 84")

  • 牛客华为机试HJ542022-04-21 07:35:20

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 简单处理直接使用 eval把字符串表达式直接求值。 用栈计算方式参考: HJ50 四则运算。 2、代码实现 import sys for line in sys.stdin: s = line.strip() print(int(eval(s)))

  • 牛客华为机试HJ562022-04-21 07:34:20

    原题传送门 1. 问题描述 2. Solution 1、思路分析 遍历,求所有的真因子,对所有真因子求和。 2、代码实现 import sys if sys.platform != "linux": file_in = open("input/HJ56.txt") sys.stdin = file_in def is_perfect_number(n): factors = [1] i = 2 w

  • 牛客华为机试HJ602022-04-21 07:33:41

    原题传送门 1. 问题描述 2. Solution 1、思路 从中间n//2向两侧遍历,找到第一组素数和即可。 2、实现 import sys if sys.platform != "linux": file_in = open("input/HJ60.txt") sys.stdin = file_in def is_prime(n): i = 2 while i * i <= n: if n

  • 牛客华为机试HJ342022-04-20 08:01:51

    原题传送门 1. 问题描述 2. Solution 1、思路分析 按ASCII码排序 2、代码实现 import sys if sys.platform != "linux": sys.stdin = open("input/HJ34.txt") for line in sys.stdin: s = line.strip() sorted_s = sorted(s, key=lambda x: ord(x)) print(&qu

  • 正则表达式2022-04-13 19:03:36

    做一道wechall题目时临时学的东西,稍微记下学习记录 原题 大意是分为4个阶段,分别匹配空字符串、wechall、wechall/wechall4后缀为.jpg/.png/.tiff/.png/.gif,与匹配前一个情况但不返回后缀

  • freecodecamp题目2022-03-11 13:33:38

    原题链接: https://www.freecodecamp.org/learn/responsive-web-design/basic-html-and-html5/check-radio-buttons-and-checkboxes-by-default 疑问: You should not change the inner text of the Indoor label. You should not change the inner text of the Loving label.

  • 面试阿里4轮Java研发岗,成功拿下Offer(原题复盘)2022-02-25 22:02:17

    这次面试阿里也是做了很多的准备,还好顺利拿到了offer,特分享一下这次的4面技术面真题,以及一份字节2-2师兄整理的面试手册,希望能够给一些正在面试字节或计划面试大厂的朋友提供帮助。 字节跳动技术一面 讲一下线程参数的含义 Innodb的索引实现 为什么是B+树? Redis的使用,分布式锁

  • 1447. 最简分数2022-02-10 10:05:55

    查看原题 解题思路 双重遍历分子分母,求出他们的最大公约数,如果公约数不为一,则说明不是最简分数,直接跳过(因为前面已经计入)。 代码 /** * @param {number} n * @return {string[]} */ var simplifiedFractions = function(n) { let arr = []; for(let i = 1; i <= n; i++)

  • Leetcode 518. 零钱兑换 II(DAY 232)---- 后端面试题2022-01-27 09:32:34

    文章目录 原题题目代码实现(首刷大部分看解 注意外层循环) 原题题目 代码实现(首刷大部分看解 注意外层循环) class Solution { public: int change(int amount, vector<int>& coins) { vector<int> dp(amount+1,0); dp[0] = 1; for(const

  • 【16】牛客网BC182022-01-24 12:04:11

    原题链接 思路:求商用 / 求余数用 % #include <stdio.h> int main() { int a = 0; int b = 0; scanf("%d %d", &a, &b); int m = a / b; int n = a % b; printf("%d %d", m, n); return 0; }

  • 2. 全排列2022-01-23 19:00:07

    题目描述 原题链接 说明 复杂度分析 时间复杂度 空间复杂度 代码

  • 1332. 删除回文子序列 判断原字符串是否是回文串2022-01-22 09:01:25

    查看原题 解题思路 因为删除的是子回文串,所以最大删除次数为2。当字符串本身是一个回文串,则删除一次就行,如果不是则需要删除2次。 代码 /** * @param {string} s * @return {number} */ var removePalindromeSub = function(s) { const length = s.length; for(let i = 0 ;i

  • LeetCode1518-换酒问题2022-01-13 22:04:59

    原题链接:https://leetcode-cn.com/problems/water-bottles/ 代码: 1 class Solution: 2 def numWaterBottles(self, numBottles: int, numExchange: int) -> int: 3 total = numBottles 4 while(numBottles >= numExchange) : 5 numBottles

  • LintCode练习:2832 · 简单校验一下邮箱格式2022-01-06 17:36:22

    他来了他来了,调了好几个Bug它终于通过了! 原题:    参考代码: 1 public class Solution { 2 public static boolean isMatch(String s) { 3 String regex = "^([A-Za-z]|_)([.\\w-]+)@([.\\w-]+)(.com)(|(.[\\w]+))$"; 4 return(s.matches(regex)); 5 }

  • 1091 N-自守数 (15 分)2021-12-12 20:02:20

    原题 https://pintia.cn/problem-sets/994805260223102976/problems/1071785664454127616 代码 #include <iostream> #include <algorithm> using namespace std; int main() { int M,N; cin>>M; for(int i=0;i<M;i++){ bool flag=true

  • 力扣原题:387. 字符串中的第一个唯一字符2021-11-15 17:32:45

    字符串中的第一个唯一字符 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。 示例: s = "leetcode" 返回 0 s = "loveleetcode" 返回 2 提示:你可以假定该字符串只包含小写字母。 代码: ``/方法一:使用哈希表存储频数/ Map<Character,Integer> map=n

  • 04 线性DP2021-11-05 18:04:02

    数字三角形(也可以使用记忆化搜索来做) 原题链接 https://www.acwing.com/problem/content/900/ # 顺推 #include<bits/stdc++.h> using namespace std; const int N = 510; const int INF = 0x3f3f3f3f; int f[N][N]; int a[N][N]; int main() { int n; cin>>n; fo

  • 安力群创新实验室Python组第二次面试笔试题:原题+解析 快来查收吧~2021-11-02 22:30:01

    前言: 本次二面命题参与人员主要由我和李阳大佬以及刘同学命制,试题呢已经由我们班同学和实验室学哥做过了,做完后都有一个总体的感觉:太细了!你会发现这套题其实很基础,但做完后分数却很低,我们也听取了他们的意见,将试题又完善了一遍。自我感觉这套试题出的真的很有质量。方方面面

  • Leetcode原题-数字的补数(不用位运算)2021-10-24 14:01:07

    对整数的二进制表示取反(0 变 1 ,1 变 0)后,再转换为十进制表示,可以得到这个整数的补数。 例如,整数 5 的二进制表示是 “101” ,取反后得到 “010” ,再转回十进制表示得到补数 2 。 给你一个整数 num ,输出它的补数。 示例 1: 输入:num = 5 输出:2 解释:5 的二进制表示为 101(没有前导

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

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

ICode9版权所有