【Codeforces Round #451 (Div. 2) B】Proper Nutrition
Codeforces div round
2023-09-14 09:03:45 时间
【链接】 我是链接,点我呀:)
【题意】
【题解】
可以直接一层循环枚举。 也可以像我这样用一个数组来存y*b有哪些。 当然。感觉这样做写麻烦了。。【代码】
/*
1.Shoud it use long long ?
2.Have you ever test several sample(at least therr) yourself?
3.Can you promise that the solution is right? At least,the main ideal
4.use the puts("") or putchar() or printf and such things?
5.init the used array or any value?
6.use error MAX_VALUE?
7.use scanf instead of cin/cout?
8.whatch out the detail input require
*/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
long long n,a,b;
bool bo[(int)1e7+100];
int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n >> a >> b;
for (ll y = 0;;y++){
if (y*b>1e7) break;
bo[y*b] = true;
}
for (ll x = 0;;x++){
ll temp = n-x*a;
if (temp<0) break;
if (bo[temp]){
cout <<"YES"<<endl;
cout << x <<' '<<temp/b<<endl;
return 0;
}
}
cout <<"NO"<<endl;
return 0;
}
相关文章
- html中div滚动条设置,DIV滚动条属性及样式设置方式「建议收藏」
- Edu Codeforces Round 115 (Div. 2)
- Codeforces Round #674 (Div. 3)(A~D)
- 【题解】codeforces-1194B
- CodeForces – 1312D 组合数
- Codeforces Global Round 23(A~C)
- Codeforces Round #828 (Div. 3) (A~D)
- CodeForces 750A New Year and Hurry
- CodeForces - 999B Reversing Encryption
- A. Vasya and Book ( Codeforces Educational Codeforces Round 55 )
- B. Heaters ( Codeforces Round #515 (Div. 3) )
- MySQL中DIV函数的使用方法(mysql中div的用法)
- 深入理解MySQL中的DIV函数(mysql中div)