leetcode contest weekly 351

LeetCode 刷题

LeetCode 刷题 577. 员工奖金【左连接: A left join B on...】 左连接后是一个新的表,后可以 + where 语句 # Write your MySQL query statement below select name, bonus from Employee le ......
LeetCode

AtCoder Beginner Contest(abc) 328

B - 11/11 难度: ⭐ 题目大意 在某个世界一年有n个月, 每个月有di天, 问有多少个日期, 该日期和月份组成的数字都是一样的; eg: 11月的1日, 22月的22日; 解题思路 暴力就行; 神秘代码 #include<bits/stdc++.h> #define int long lo ......
Beginner AtCoder Contest 328 abc

【pwn】[HNCTF 2022 WEEK2]ret2libc --rop构造泄露libc

这道题是简单的libc,不过多分析了 exp: from pwn import * from LibcSearcher import * io=remote("node5.anna.nssctf.cn",28341) elf=ELF("./pwn") put_got=elf.got["puts"] ......
libc ret2libc HNCTF 2libc WEEK2

Princeton Algorithms, Part I week2 Merge Sort

Merge sort 今天学习merge sort 这个排序算法的思想就是,不停的将数组二分,再将两个子数组不停归并。其中有一个操作叫merge如下图所示。左右两边两个部分是有序的,然后思想也很简单 有两个指针i和j,i指向lo,j指向mid+1,然后比较两个指针所指的大小,如果小就选出来排到数组中 ......
Algorithms Princeton Merge week2 Part

AtCoder Beginner Contest 325

A - Takahashi san #include <bits/stdc++.h> using namespace std; #define ll long long using vi = vector<int>; int main(){ ios::sync_with_stdio(false); ......
Beginner AtCoder Contest 325

[LeetCode] 2785. Sort Vowels in a String

Given a 0-indexed string s, permute s to get a new string t such that: All consonants remain in their original places. More formally, if there is an i ......
LeetCode Vowels String 2785 Sort

[LeetCode] 1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance

There are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional and weighted edge b ......
the Neighbors Threshold LeetCode Distance

AtCoder Beginner Contest 323

A - Weak Beats #include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using vi = vector<int>; int main() { ios::sync_with_stdio(fal ......
Beginner AtCoder Contest 323

【pwn】[HGAME 2023 week1]choose_the_seat --数组越界,劫持got表

查一下程序保护情况 发现是partial relro,说明got表是可以修改的,下一步看代码逻辑 看到这一段 puts(&seats[16 * v0]);存在数组越界的漏洞,因为上面的代码没有对v0进行负数的限制,v0可以是负数,我们来看一下seat的数据 可以发现seat上面的数据就是got表,s ......
数组 choose_the_seat choose HGAME week1

Toyota Programming Contest 2023#7(AtCoder Beginner Contest 328)

Toyota Programming Contest 2023#7(AtCoder Beginner Contest 328) A. Not Too Hard 题意: 将给定的数列\(a\)中数值小于\(x\)的数累加。 解题思路: 模拟。 代码: #include<bits/stdc++.h> u ......
Contest Programming Beginner AtCoder Toyota

[Leetcode] 0836. 矩形重叠

836. 矩形重叠 English Version 题目描述 矩形以列表 [x1, y1, x2, y2] 的形式表示,其中 (x1, y1) 为左下角的坐标,(x2, y2) 是右上角的坐标。矩形的上下边平行于 x 轴,左右边平行于 y 轴。 如果相交的面积为 正 ,则称两矩形重叠。需要明确的是, ......
矩形 Leetcode 0836

LeetCode 第 115 场双周赛

2899. 上一个遍历的整数 感觉读题比较困难 class Solution { public: vector<int> lastVisitedIntegers(vector<string>& words) { vector<int> res , a ; for( int i = 0 , cnt = ......
LeetCode 115

AtCoder Beginner Contest 328 (ABC328)

A. Not Too Hard 模拟。 Code B. 11/11 模拟。 Code C. Consecutive Description 给你一个字符串 \(S\),有 \(Q\) 次询问,每次输入 \(l, r\),求:\([S_l,S_r]\) 区间中有多少个相邻的字符是相等的。 Soluti ......
328 Beginner AtCoder Contest ABC

2023 Nov. Week-2 Summary

2023 Nov. Week-2 Summary 2023.11.06 - 2023.11.12(椰树牌椰汁!) 学习内容 学了 基础算法(补题ing 高维前缀和 各种贪心的练 最小度限制生成树 基本的推狮子 动态规划 树形 D P,换根 D P wqs 二分 如学(需要复习 / 做题) 数据结构 ......
Summary 2023 Week Nov

LeetCode -- 第 371 场周赛(哈希表,tire字典树)

class Solution { public: vector<string> findHighAccessEmployees(vector<vector<string>>& access_times) { int n = access_times.size(); vector<string> re ......
字典 LeetCode tire 371

leetcode hot100-02 字母异位词分组

题目:字母异位词分组 难度:中等 地址:https://leetcode.cn/classic/problems/group-anagrams/description/ 描述:给你一个字符串数组,请你将 字母异位词 组合在一起。可以按任意顺序返回结果列表。字母异位词 是由重新排列源单词的所有字母得到 ......
字母 leetcode hot 100

leetcode hot 100-01 两数之和

题目:两数之和 难度:简单 题目地址:https://leetcode.cn/classic/problems/two-sum/description/ 过程一,因为难度是简单,就没有仔细审题,以为返回两个数就好,使用双指针,逻辑如下: 对数组排序 双指针分别指向头和尾 两数之和大于target,尾 ......
之和 leetcode hot 100

[LeetCode] 1360. Number of Days Between Two Dates 日期之间隔几天

Write a program to count the number of days between two dates. The two dates are given as strings, their format is YYYY-MM-DD as shown in the examples ......
LeetCode 之间 日期 Between Number

Kattis - Add or Multiply (Rocky Mountain Regional Contest 2023)

Intro Given a math expression with + or * sign with single digit numbers (1 to 9). Support the following operations: Swap 2 number and evaluate the wh ......
Multiply Mountain Regional Contest Kattis

AtCoder Beginner Contest 328

AtCoder Beginner Contest 328) A - Not Too Hard 扫一遍求和。 B - 11/11 枚举,判断。 C - Consecutive 对于相等的 \(a_i=1\), 做一遍前缀和。 D - Take ABC 用一个栈维护即可。 E - Modulo MST ......
Beginner AtCoder Contest 328

AtCoder Beginner Contest 328

A - Not Too Hard (abc328 A) 题目大意 给定\(n\)个数字和一个数 \(x\)。 问不大于 \(x\)的数的和。 解题思路 按找要求累计符合条件的数的和即可。 神奇的代码 #include <bits/stdc++.h> using namespace std; usin ......
Beginner AtCoder Contest 328

AtCoder Beginner Contest 328

A 傻逼题。 B 傻逼题 C 傻逼题 D 不难发现,每次添加一个字符,如果可以当前的答案组成 ABC 就删。然后模拟即可。 E 两种方法。 二进制枚举使用了哪些边。 可以发现有用的状态只有 \(\binom{m}{n-1}\),上限大概 \(10^5\),剩余无用状态过了就行。复杂度 \(O(m2^ ......
Beginner AtCoder Contest 328

【pwn】[HGAME 2023 week1]simple_shellcode --orw利用攻击

先查看程序的保护状态 可以看到,保护全开,拖进ida看主函数的逻辑 可以看到有个mmap函数: mmap() 函数是Unix和类Unix操作系统中的一个系统调用,用于在进程的地址空间中映射文件或者其它对象。这样做的好处是可以让文件直接映射到内存中,从而避免了频繁的文件 I/O 操作,提高了文件的读取 ......

The 2023 ICPC Nanjing Regional Contest G,F

G. 背包 我们要是选一个集合出来 并且免除k个宝石的话 我们一定是选最贵的k个宝石免费 这样我们的做法就是对wi排序 然后前面的做背包 后面直接贪心选vi最大的k个 这样是一定包含了最优解的 当然你可以用二分bit 也可以直接维护另一个dp int n,tr1[200010],tr2[200010 ......
Regional Contest Nanjing 2023 ICPC

Kattis - A Complex Problem (The 2023 ICPC Rocky Mountain Regional Contest)

Intro This was one of the problems I didn't do during the regional contest. One of my teammates solved it. Observation There are few things to note. F ......
Mountain Regional Complex Contest Problem

AtCoder Beginner Contest(abc) 322

B - Prefix and Suffix 难度: ⭐ 题目大意 给定两个字符串t和s, 如果t是s的前缀则输出1, 如果是后缀则输出2, 如果都是则输出0, 都不是则输出3; 解题思路 暴力即可; 神秘代码 #include<bits/stdc++.h> #define int l1ng l1ng ......
Beginner AtCoder Contest 322 abc

The 10th Jimei University Programming Contest

外校打星队伍,排名22/450,还算凑合吧。 A. A+B问题 直接枚举进制 #include <bits/stdc++.h> using namespace std; using vi = vector<int>; void solve() { string str; vi a, b, s; ci ......
Programming University Contest Jimei The

Leetcode133.克隆图

需要注意图中存在环路。 JAVA: public final Node cloneGraph(Node node) { return deepCopy(node, new HashMap<Integer, Node>()); } private Node deepCopy(Node node, Ha ......
Leetcode 133

Atcoder Beginner Contest 321 G - Electric Circuit 题解 - 状压dp | 指定最低位

为了更好的阅读体验,请点击这里 题目链接:G - Electric Circuit 看到了 \(N\) 的数据范围,因此是显然的状压 dp。 不妨设 \(f_S\) 为仅使用 \(S\) 集合中的所有点,能够连成恰好 \(1\) 个连通块的方案数。\(g_S\) 为仅使用 \(S\) 集合中的所有点 ......
题解 Beginner Electric Atcoder Contest

AtCoder Beginner Contest(abc) 321

B - Cutoff 难度: ⭐⭐ 题目大意 一场考试有n门成绩, 最终成绩是减去最大值和最小值后的和; 现在给出n-1门成绩, 问最后一门成绩最少为多少可以让总成绩大于等于m; 解题思路 列举第n门成绩由小到大时其他成绩所要满足的条件即可; 神秘代码 #include<bits/stdc++.h> ......
Beginner AtCoder Contest 321 abc