题意 供应链有3种人,零售商,经销商和供应商,供应链上的人都可以从自己的供应商那里以P的价格买入,而后以r%的涨幅卖给下一级,问供应链上找零售商买价格最低是多少 思路 每一层的价格涨幅都是一样的,所以这个问题等价于从根结点出发找最短的路到零售商。用BFS和DFS都可以做,DFS代码量少我就用DFS了 ...
分类:
其他好文 时间:
2020-10-05 22:33:38
阅读次数:
48
#include <iostream> #include <string> #define MAX 500 using namespace std; struct person { string name; int age; }; struct contact { person persons[MA ...
分类:
编程语言 时间:
2020-10-05 22:33:17
阅读次数:
48
查询回文子串个数: #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<double,int> pii; const int N = 3e5+5; const int M = 1e6+5; c ...
分类:
其他好文 时间:
2020-10-05 22:16:55
阅读次数:
30
题意 树的层序遍历的问题,找到结点数最多的一层,输出结点树和对应层号 思路 看到是树层序遍历就立马反应过来用BFS做,可以说是裸模版的题目了 层序遍历在每次扩展状态的时候都是取一层的结点数进行扩展,此时就可以直接比较来找题目要求的解了 代码 #include <algorithm> #include ...
分类:
其他好文 时间:
2020-10-05 21:55:34
阅读次数:
27
#include<bits/stdc++.h> using namespace std; const int N = 300010; vector<int>p[N]; int ans[N]; int main() { int t; scanf("%d",&t); while(t --) { int ...
分类:
其他好文 时间:
2020-10-05 21:46:03
阅读次数:
23
#include <stdio.h>int main(){ int hour1, minute1; int hour2, minute2; scanf("%d%d",&hour1,&minute1); scanf("%d%d",&hour2,&minute2); int t1 = hour1*60+ ...
分类:
其他好文 时间:
2020-09-24 20:54:35
阅读次数:
30
1、原始表 CREATE TABLE [dbo].[BASE_UserInDept]( [HospitalID] [int] NOT NULL, [UserID] [int] NOT NULL, [DeptCode] [varchar](10) NOT NULL, [RoleID] [int] NO ...
分类:
数据库 时间:
2020-09-24 00:02:06
阅读次数:
55
1 #include "apue.h" 2 3 int globvar = 6; 4 char buf[] = "a write to stdout\n"; 5 6 int main() 7 { 8 int var; 9 pid_t pid; 10 11 var = 88; 12 if (write ...
分类:
其他好文 时间:
2020-09-18 04:07:04
阅读次数:
36
1046 Shortest Distance (20分) #include<stdio.h> #include<iostream> using namespace std; int main() { int length[100100]; int n,n2,num=0; int c1,c2; sca ...
分类:
其他好文 时间:
2020-09-18 03:18:51
阅读次数:
29
https://www.luogu.com.cn/problem/P4721 很多题的dp方程写出来后是这种形式 这种东西当然可以cdq分治FFT解决 但实际上做一些推导就可以只利用多项式求逆解决 这个递推式可以这么来看 fn表示 用一些长度为1...n-1的长条 来组成 一个长度为n的长条一共有多 ...
分类:
其他好文 时间:
2020-09-18 03:15:13
阅读次数:
27