【Educational Codeforces Round 35 B】Two Cakes
Codeforces round 35 two Educational
2023-09-14 09:03:45 时间
【链接】 我是链接,点我呀:)
【题意】
【题解】
从小到大枚举x. 看看a/x+b/x是不是大于等于n 是的话。 看看是不是两种蛋糕都能凑一堆。 也即x的最大枚举量是min(a,b) 不然可能有多余的a%x没地方放。(因为它都还没有一堆【代码】
#include <bits/stdc++.h>
using namespace std;
int n,a,b;
int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n >> a >> b;
int ans = 1;
for (int i = 1;i <= min(a,b);i++){
int temp = a/i + b/i;
if (temp>=n){
ans = i;
}
}
cout << ans << endl;
return 0;
}
相关文章
- Codeforces Round #806 (Div. 4)(A~F)
- Edu Codeforces Round 115 (Div. 2)
- Codeforces Round #754 (Div. 2) C-E
- 【算法竞赛】Codeforces Round #829 (Div. 2) A-F
- Codeforces Round #825 (Div. 2) (A~C1)
- CodeForces – 1312D 组合数
- Codeforces Round #784 (Div. 4)(A~F)
- Educational Codeforces Round 137 (Rated for Div. 2)(A~E)
- 【算法竞赛】Codeforces Round #841 (Div. 2) C, E
- CodeForces 750A New Year and Hurry
- CodeForces - 999C Alphabetic Removals
- A. Vasya and Book ( Codeforces Educational Codeforces Round 55 )
- A. Vova and Train ( Codeforces Round #515 (Div. 3) )
- A. Be Positive 【 Codeforces Round #542 [Alex Lopashev Thanks-Round] (Div. 2) 】
- Codeforces 842B Gleb And Pizza几何,水详解编程语言
- Codeforces 842A Kirill And The Game暴力,水详解编程语言
- 函数探索MySQL中Round函数的神秘之处(mysql中round)