本文主要是介绍AtCoder Beginner Contest 195,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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;
}
这篇关于AtCoder Beginner Contest 195的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!