2024年9月2日
摘要: 随机数 import java.util.Random; public class Main { public static void main(String[] args) { Random r = new Random(); int data = r.nextInt(10); //0-9之间的随 阅读全文
posted @ 2024-09-02 09:41 Hoshino1 阅读(77) 评论(0) 推荐(0)
  2024年9月1日
摘要: 算法 cf1989 ABCD https://codeforces.com/contest/1989 B最长公共子序列 //相当于枚举以b[i]为起点遍历a的最长公共子序列 //因为是子序列所以 ab acccab 即使后面先取了第一个a也不影响最长长度 #include<bits/stdc++.h 阅读全文
posted @ 2024-09-01 11:57 Hoshino1 阅读(11) 评论(0) 推荐(0)
  2024年8月31日
摘要: 算法 CF955 1982 https://codeforces.com/contest/1982 1 数学思维 /* 我们无需考虑一直加1,而是加一个数到y的倍数这样简化的去想。 */ #include<bits/stdc++.h> #define int long long using name 阅读全文
posted @ 2024-08-31 17:15 Hoshino1 阅读(15) 评论(0) 推荐(0)
  2024年8月28日
摘要: 思维转化类 https://vjudge.net/contest/651665#problem/F 阅读全文
posted @ 2024-08-28 21:16 Hoshino1 阅读(13) 评论(0) 推荐(0)
摘要: 转义字符 public class Main{ public static void main(String[] args) { System.out.println("h\te\tl\tl\to\t"); //制表符实现对齐 // \\\\输出两个/ // 输出双引号需要转义字符 \" \" // 阅读全文
posted @ 2024-08-28 20:37 Hoshino1 阅读(17) 评论(0) 推荐(0)
  2024年8月14日
摘要: 1 差分模板 //一维差分 void insert(int l,int r,int x) { s[l]+=x; s[r+1]-=x; } //初始化 for(int i=1;i<=n;i++) insert(i,i,a[i]); //二维差分 void insert(int x1,int y1,in 阅读全文
posted @ 2024-08-14 09:17 Hoshino1 阅读(40) 评论(0) 推荐(0)
摘要: 1 E - Opening Ceremony https://vjudge.net/contest/647025#problem/E 当时想的太复杂没想到消掉最下面一层最优,因为相对层数不变。 #include<stdio.h> #include<algorithm> using namespace 阅读全文
posted @ 2024-08-14 09:13 Hoshino1 阅读(14) 评论(0) 推荐(0)
摘要: 1 VJ练习 1)钟表匹配 https://vjudge.net/contest/647025#problem/H 阅读全文
posted @ 2024-08-14 08:52 Hoshino1 阅读(13) 评论(0) 推荐(0)
  2024年8月13日
摘要: 1 前缀和练习 1)跳楼机人数安排 题目 点击查看代码 中文解释#include <bits/stdc++.h> using namespace std; #define int long long #define dbg(x) cout << #x << '=' << x << endl cons 阅读全文
posted @ 2024-08-13 16:25 Hoshino1 阅读(11) 评论(0) 推荐(0)
摘要: 1 广搜板子 int bfs(int sx,int sy) { q.push((Pos){sx,sy}); //起点加入队列 vis[sx][sy]=true; //标记 while(!q.empty()) { x=q.front().x; y=q.front().y; //获取起始坐标 q.pop 阅读全文
posted @ 2024-08-13 10:13 Hoshino1 阅读(31) 评论(0) 推荐(0)