A - Health M Death
#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; if(m%n==0){ cout<<"Yes"<<endl; } else { cout<<"No"<<endl; } }
B - Many Oranges
确实不好意思说自己做这题做到绝望了=。=希望能把眼睛捐给会用的人嗷
#include <bits/stdc++.h> using namespace std; int main() { int a,b,w,i,j; cin>>a>>b>>w; w*=1000; int max1=0,min1=1e9; for(i=1;i<=1000000;i++){ if(a*i<=w&&b*i>=w){ max1=max(max1,i); min1=min(min1,i); } } if(min1!=1e9&&max1!=0) cout<<min1<<" "<<max1<<endl; else cout<<"UNSATISFIABLE"<<endl; }
C - Comma
明明很简单的数学题硬要开个啥dp数组磨了十多分钟
=。=
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n,ans=0; cin>>n; if(n>=1000)ans+=n-999; if(n>=1000000) ans+=n-999999; if(n>=1000000000) ans+=n-999999999; if(n>=1000000000000) ans+=n-999999999999; if(n>=1000000000000000) ans+=n-999999999999999; cout<<ans<<endl; }