首页 > 降温(easy)
头像 此在Dasein
发表于 2025-12-07 03:03:05
这是一个典型的动态规划问题。 由于每一天的寒潮判定只依赖于当天的气温和前一天的气温,且我们需要求解的是全局的最值(最大次数和最小次数),同时数据规模较小(,气温范围仅101个整数),这非常适合使用DP来解决。 算法思路 我们需要维护到第 天为止,且第 天气温为 时,所能产生的最大和最小寒潮次数 展开全文
头像 255gxd
发表于 2025-12-07 10:49:05
#include<bits/stdc++.h> using namespace std; using ll=long long; ll mod=998244353; int main() { int n,x; cin>>n>>x; vec 展开全文
头像 Lambda_L
发表于 2025-12-07 00:33:03
纯模拟 #include <bits/stdc++.h> using namespace std; #define int long long void solve() { int n, x; cin >> n >> x; vector&l 展开全文
头像 BaiJay
发表于 2025-12-07 12:08:38
#include <bits/stdc++.h> #define int long long using namespace std; #define endl '\n' void work() { int n , x ; cin >> n >> x ; 展开全文
头像 CARLJOSEPHLEE
发表于 2024-10-30 22:26:30
分别模拟求出最大最小值即可 from sys import stdin, stdout def main(): input = stdin.readline n,x = map(int,input().split()) if n == 1: print("0 展开全文
头像 周康禧
发表于 2025-12-07 23:01:44
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using PII=pair<ll,ll>; using PIII=pair< 展开全文
头像 chenlan114
发表于 2025-12-07 13:10:41
#include <bits/stdc++.h> using namespace std; const int N=105; // 数组最大长度(题目中n≤100,留冗余) // 变量说明: // a数组:用于计算“最大寒潮次数”的温度序列(对未知温度做最大化寒潮的赋值) // b数 展开全文
头像 自由的风0450
发表于 2025-12-07 14:29:21
模拟未知温度,计算寒潮天数 #include <iostream> #include<vector> using namespace std; const int INF=-999; const int MIN_T=-50; const int MAX_T=50; int 展开全文
头像 ddhw111
发表于 2025-12-07 14:56:12
贪心。要凑到最大的数量,让可以更改的位置的数值更改成为上一个离自己最近位置并且有数值的数-x。注意如果减到小于值域下限,我们可以直接更改为值域上限。这样做的目的是方便让后面的可更改位置产生贡献。凑最小的答案,就一直让可更改位置的数值更改为上一个值-x+1即可。 #include<bits/st 展开全文
头像 鱼好软捏
发表于 2025-12-07 15:55:04
#include <iostream> #include<vector> using namespace std; int main() { int n,x; cin>>n>>x; vector<int>a(n+1 展开全文