C - Tax Increase
题目链接-C - Tax Increase
题目大意
请你找到最小的正整数
x
x
x,满足
[
x
×
0.08
]
=
A
[x×0.08]=A
[x×0.08]=A且
⌊
x
×
0.1
]
=
B
⌊x×0.1]=B
⌊x×0.1]=B,若不存在,输出-1
解题思路
- 暴力枚举,因为 1 ≤ A ≤ B ≤ 100 1≤A≤B≤100 1≤A≤B≤100,所以我们枚举到 1000 1000 1000即可
- 具体操作见代码
附上代码
#pragma GCC optimize("-Ofast","-funroll-all-loops")
#include<bits/stdc++.h>
#define int long long
#define lowbit(x) (x &(-x))
#define endl '\n'
using namespace std;
const int INF=0x3f3f3f3f;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
const double PI=acos(-1.0);
const double e=exp(1.0);
const double eps=1e-10;
const int M=1e9+7;
const int N=2e5+10;
typedef long long ll;
typedef pair<int,int> PII;
typedef unsigned long long ull;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int a,b,ans=-1;
cin>>a>>b;
for(int i=1;i<=1250;i++){
if(floor(i*0.08)==a&&floor(i*0.1)==b){
ans=i;
break;
}
}
cout<<ans<<endl;
return 0;
}