编程日记

列表

P10687 True Liars 个人题解

题目传送门 题目大意: 给你两个神圣种族和邪恶种族的人数以及询问次数,其中神圣种族的人说真话,邪恶种族的人说假话,请你判断那几个是神圣种族的人。 Solution: 题解区已经有很多带边权并查集的做法了,这里我用的…

题解:Luogu P14522 【MX-S11-T3】空之碎物

题意 定义 \(\ominus\) 为二进制不退位减法。对于一个可重集 \(S\),你可以进行若干次操作,每次操作可以选择 \(S\) 中的两个数 \(x,y\),合并成 \(x\ominus y\) 或 \(y\ominus x\)。定义 \(f(S)\) 为将 \(S\) 合并至…

1088. Rational Arithmetic (20)

1088. Rational Arithmetic (20)#include <iostream>using namespace std;long long getsame(long long a, long long b) {if(b != 0){return getsame(b, a % b);}else{return a;} }void simplify(long long &am…

1087. All Roads Lead to Rome (30)

1087. All Roads Lead to Rome (30)#include <iostream> #include <vector> #include <string.h>using namespace std;struct node {int next, cost; };vector<node> v[27000]; vector<int…

1091. Acute Stroke (30)

1091. Acute Stroke (30)#include <iostream> #include <queue>using namespace std;struct node {int x, y, z; };queue<node> q; int flag[1300][130][70], m, n, l, vis[1300][130][70], bfscoun…

解码UDP

UDP 协议基础认知 UDP(User Datagram Protocol,用户数据报协议)是传输层核心协议之一,基于 IP 协议实现跨网络主机进程间的无连接数据传输。它面向事务提供简单通信服务,不保证数据交付、有序性和重复防护,也不提…

读书笔记《投资的未来》,估算收益率

比较IBM和新泽西标准石油两家公司,一个新兴的,受追捧的,一个传统的,但结果,是石油公司胜出。尽管两只股票的业绩都不错,但是1950~2003年,新泽西标准石油的投资者每年可以取得14.42%的年收益率,这比IBM提供的1…

1101. Quick Sort (25)

1101. Quick Sort (25)#include <iostream> #include <vector> #include <algorithm>using namespace std;int num[100010], low[100010], high[100010];int main() {int n;scanf("%d", &…

1100. Mars Numbers (20)

1100. Mars Numbers (20)#include <iostream> #include <string.h>using namespace std;char ch[2][13][5] = {"tret", "jan", "feb", "mar", "apr",…

1083. List Grades (25)

1083. List Grades (25)#include <iostream>using namespace std;struct node {char name[20], id[20]; }stu[110];int flag[110];int main() {int n;scanf("%d", &n);int i, grade;node nod;for(…

解码网络编程基础

进程间通信方式 基础概念 程序是数据和指令的集合,运行时成为进程,操作系统会为其分配资源并记录参数。同一主机内进程通信可通过管道、信号、消息队列、信号量集、共享内存实现,这些方式依赖主机本地系统资源,无法…

C++的3种继承方式

C++的3种继承方式 在 C++ 中,继承方式(public、protected、private)决定了基类成员在派生类中的访问权限,以及派生类对象对基类成员的访问权限。正确选择继承方式是实现封装、复用和多态的关键。以下是三种继承方式…

1082. Read Number in Chinese (25)

1082. Read Number in Chinese (25)#include <iostream> #include <string.h>using namespace std;int first = 1;void setfirst() {if(first == 1){first = 0;}else{printf(" ");} }int main()…