题解:P12404 「CZOI-R3」可爱棉羊

· · 题解

思路

对于最大值,我们可以发现一只羊在经过 T 天后,最多可以传染包括自己在内的 2*T 只羊。那么 x 只羊最多可以传染 2*x*T 只羊,同时记得与 N 比较。

对于最小值,当 x 大于 $1

## 代码 ```cpp #include<bits/stdc++.h> #define int long long using namespace std; int n,t,x; signed main() { cin>>n>>t>>x; printf("%lld ",min(n,2*x*t)); if(x==1){ printf("%lld\n",min(n,(long long)2)); } else { printf("%lld\n",min(n,x)); } return 0; } ```