标签:++ and 存在 one using its adf http lse
A - Station and Bus
#include <bits/stdc++.h> using namespace std; char s[5]; int main() { //freopen("in.txt","r",stdin); scanf("%s",s); int a=0,b=0; for(int i=0;s[i];i++) { if(s[i]==‘A‘) a++; else b++; } printf("%s\n",a&&b?"Yes":"No"); return 0; }
B - Count Balls
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { //freopen("in.txt","r",stdin); ll n,a,b; scanf("%lld%lld%lld",&n,&a,&b); printf("%lld\n",n/(a+b)*a+min(n%(a+b),a)); return 0; }
C - Tax Increase
题意:找到最小的正整数x,满足$\left \lfloor x*0.08 \right \rfloor = A$并且$\left \lfloor x*0.1 \right \rfloor = B$,若不存在,输出-1。
数据范围:1<=A<=B<=100。
题解:暴力枚举x判断即可,至少要枚举到1000。
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { //freopen("in.txt","r",stdin); int a,b; scanf("%d%d",&a,&b); bool f=false; for(int i=1;i<=1500;i++) { if(i*8/100==a&&i/10==b) { printf("%d\n",i); f=true; break; } } if(!f) printf("-1\n"); return 0; }
D - String Formation
标签:++ and 存在 one using its adf http lse
原文地址:https://www.cnblogs.com/zdragon1104/p/12441877.html