Initial commit

This commit is contained in:
2025-03-14 22:39:32 +08:00
commit 7b1e0f329e
38 changed files with 1153 additions and 0 deletions

26
14lanqiao/test3-2.cpp Normal file
View File

@@ -0,0 +1,26 @@
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int mxv = INT_MIN; int miv = INT_MAX;
for(int i = 1; i <= n; i++){
int a, b; cin >> a >> b;
miv = min(miv, a/b);
mxv = max(mxv, a/(b+1)+1);
}
cout << mxv << " " << miv << endl;
return 0;
}
/*
数学优化
通过floor(A/V) = B可以推出 A/V =B,B+1
进而得到B <= A/V < B+1三个表达式同时被A除
得到关于V的不等式即 A/B >= V > A/(B+1)
*/
/* test samples
3
75 3
53 2
59 2
*/