A
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
/*#include<cstring>#include<algorithm>#include<queue>#include<vector>#include<cstdio>#include<cmath>#include<iostream>*/ #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 300005; int main() { int k, n, s, p; cin >> k >> n >> s >> p; int ans = n / s + (1 - (n % s == 0)); ans *= k; cout << ans / p + (1 - (ans % p == 0)) << endl; return 0; }
B
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
/*#include<cstring>#include<algorithm>#include<queue>#include<vector>#include<cstdio>#include<cmath>#include<iostream>*/ #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 300005; char f[105][105]; int ans; int aimc = 1; int aimr = 1; int flag; int now; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { scanf("%s", f[i] + 1); } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (f[i][j] == '#') { continue; } now = 0; for (int dx = j - k + 1; dx <= j; dx++) { if (dx + k > n + 1) { break; } if (dx < 1) { continue; } flag = 1; for (int w = dx; w <= dx + k - 1; w++) { if (f[i][w] == '#') { flag = 0; break; } } if (flag) { now++; } } for (int dy = i - k + 1; dy <= i; dy++) { if (dy + k > n + 1) { break; } if (dy < 1) { continue; } flag = 1; for (int w = dy; w <= dy + k - 1; w++) { if (f[w][j] == '#') { flag = 0; break; } } if (flag) { now++; } } if (now > ans) { ans = now; aimc = i, aimr = j; } } } cout << aimc << " " << aimr << endl; return 0; }
C
首先用贪心的思想可以知道 如果是一整轮一整轮地分 肯定是X越大越好
当加上题目剩下的不小于X的也要分的时候 最佳肯定是当X尽量大且最后多分给A1一次的时候最佳
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n,k,m,d; cin >> n >> k >> m >> d; ll anser=0; for(ll i=1;i<=d;i++) { if(i!=1) { ll now=n/(i-1); if(now<k) continue; } ll sum=n/(k*i-k+1); if(sum>m) { if(m*i>=(n-n%m)/k) sum=m; else continue; } anser=max(anser,sum*i); } cout<<anser<<endl; return 0; }
D
这题的建模是一个网络流 第i个石头对每个[i+1,i+l]都有一条容量为a[i]的边 源点与左岸相连 汇点与右岸相连 算最大流
但其实可以用最大流最小割思想简化 因为你跳的次序并不会影响最后的答案 所以我们可以认定每次全部青蛙都在一个长度为L的窗口内
所以答案就是min(sum(ai~ai+l)) 即视连续L个石头为一个节点 前一个节点有指向后一个节点sum(ai~ai+l)的边 所以最大流是最小的那条边
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
#include<bits/stdc++.h> using namespace std; typedef long long ll; int a[100005]; int main() { int n, l; cin >> n >> l; n--; int minn = INT_MAX; int sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < l; i++) { sum += a[i]; } minn = sum; for (int i = l; i <= n - 1; i++) { sum -= a[i - l]; sum += a[i]; minn = min(minn, sum); } cout << minn << endl; return 0; }
E