高斯消元解线性方程组 时间复杂度:O(\(n^3\)) https://www.luogu.com.cn/problem/P3389 题意:给定一个线性方程组,对其求解。 #include <bits/stdc++.h> using namespace std; const char nl = '\ ...
分类:
其他好文 时间:
2021-02-17 14:54:53
阅读次数:
0
原题链接 考察:状压dp 思路: 考虑到计算三角形,我们需要知道落脚点i和前一个落脚点j,所以需要三维数组.根据状态转移方程f[i][j][k] = f[i-{j}][k][t]+score很容易求出最大的权值.但是比较难想到怎么计算路径数目(对本蒟蒻而言).方法是再声明一个记录当前路径最大值的方案 ...
分类:
其他好文 时间:
2021-02-17 14:41:52
阅读次数:
0
写在前边 链接:Codeforces Round #701 (Div. 2) 数学场,题目描述简单粗暴,思路很妙,代码短的不行,都是好神奇的一些题目。 A. Add and Divide 链接:A题链接 题目大意: 给定两个正整数,我们可以进行两个操作: \(a = \lfloor \frac{a} ...
分类:
其他好文 时间:
2021-02-17 14:39:22
阅读次数:
0
题目链接:https://codeforces.com/contest/1480/problem/C 题解: 二分法。设定查找区间为$[1,n]$。若$a_<a_{mid+1}$若$a_>a_$,则$a_$为可行解。若$a_<a_$同理可得除非$a_n$在区间$[l,mid]$严格单调增加,否则必有 ...
分类:
其他好文 时间:
2021-02-17 14:36:41
阅读次数:
0
使用"os/ioutil"包中的ReadFile方法, func ReadFile(path string) ([]byte, err) package main import ( "fmt" "io/ioutil" ) func main(){ // ioutil包中的ReadFile,一次性读取 ...
分类:
其他好文 时间:
2021-02-17 14:34:50
阅读次数:
0
快速幂 (1)快速幂 求 \(a^k\ mod\ p\) 时间复杂度:O($\log$k) https://www.luogu.com.cn/problem/P1226 题意:求 \(a^k \ mod \ p\) #include <cstdio> #include <iostream> usin ...
分类:
其他好文 时间:
2021-02-17 14:14:44
阅读次数:
0
题目链接: https://www.luogu.com.cn/problem/P6144 题意: 已经描述的很清楚了,略。 题解: 考虑 \(K=1\) 时的做法: 此时如果沿用 G 组该题的简单做法,是行不通的。 不过仍然是类似的做法,以每个区间结尾的贡献的和。 考虑区间 \([l,r]\) : ...
分类:
其他好文 时间:
2021-02-17 14:07:20
阅读次数:
0
思路:在建树的同时进行判断,把建树的模板改一改就能用 #include<iostream> #include<queue> #include<string.h> #include<string> #include<map> #include<unordered_map> #include<vecto ...
分类:
其他好文 时间:
2021-02-17 14:00:40
阅读次数:
0
A - Favorite Sound #include<bits/stdc++.h> using namespace std; const int N = 1e6 + 5; typedef long long LL; int main(){ int a, b, c; cin >> a >> b >> ...
分类:
其他好文 时间:
2021-02-16 12:44:42
阅读次数:
0
水题~。 int n; int main() { cin>>n; string res; int t=n/100; for(int i=0;i<t;i++) res+='B'; t=n%100/10; for(int i=0;i<t;i++) res+='S'; t=n%100%10; for(in ...
分类:
其他好文 时间:
2021-02-16 12:32:36
阅读次数:
0