docs: 更新README并清理测试代码

更新README添加超时优化方法,同时清理test.cpp中未使用的代码
This commit is contained in:
Zengtudor 2025-09-02 15:41:38 +08:00
parent 64a6dc8651
commit 17a58ec2aa
2 changed files with 7 additions and 18 deletions

View File

@ -13,4 +13,9 @@
### ###
1. 编辑距离 i-1,j i,j-1 1. 编辑距离 i-1,j i,j-1
2. 合并石子 1~k,k+1~i 2. 合并石子 1~k,k+1~i
3. 网捉蛇 1~k用j-1, k+1~i用1 3. 网捉蛇 1~k用j-1, k+1~i用1
## 超时优化的三种方法
1. 预处理(排序最常用)
2. 二分
3. 数学方法

View File

@ -1,19 +1,3 @@
#include <cmath>
#include <iostream>
#include <set>
#include <stdexcept>
#include <string>
int main(){ int main(){
int n;
std::cin>>n;
std::set<int> s;
std::cout<<n<<"\n";
for(int i=1;i<=n;i++){
int tmp;
std::cin>>tmp;
if(s.find(tmp)==s.end()){
throw std::runtime_error(std::to_string(tmp));
}
s.insert(tmp);
}
} }