M-SOLUTIONS Programming Contest 2020总结
生活随笔
收集整理的這篇文章主要介紹了
M-SOLUTIONS Programming Contest 2020总结
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
A - Kyu in AtCoder
直接模擬
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0) #define debug(x) cout<<#x<<": "<<x<<" " #include<iostream> #include<algorithm> using namespace std; int main() {IO;int x;cin>>x;//cout<<10-x/200<<endl;標準答案if(x<=599) cout<<'8'<<endl;else if(x<=799) cout<<'7'<<endl;else if(x<=999) cout<<'6'<<endl;else if(x<=1199) cout<<'5'<<endl;else if(x<=1399) cout<<'4'<<endl;else if(x<=1599) cout<<'3'<<endl;else if(x<=1799) cout<<'2'<<endl;else cout<<'1'<<endl;return 0; }B - Magic 2
貪心
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0) #define debug(x) cout<<#x<<": "<<x<<" " #include<iostream> #include<algorithm> using namespace std; int main() {IO;int a,b,c,k;cin>>a>>b>>c>>k;int cnt=0;while(b<=a){b*=2;cnt++;}while(c<=b){c*=2;cnt++;}if(cnt<=k) cout<<"Yes"<<endl;else cout<<"No"<<endl;return 0; }C - Marks
比較一下就可以了
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0) #define debug(x) cout<<#x<<": "<<x<<" " #include<iostream> #include<algorithm> using namespace std; const int N=200010; int a[N]; int main() {IO;int n,k;cin>>n>>k;for(int i=1;i<=n;i++) cin>>a[i];for(int i=k+1;i<=n;i++){if(a[i]>a[i-k]) cout<<"Yes"<<endl;else cout<<"No"<<endl;}return 0; }D - Road to Millionaire
貪心:有錢就賺,低買高賣
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0) #define debug(x) cout<<#x<<": "<<x<<" " #include<iostream> #include<algorithm> using namespace std; typedef long long ll; const int N=100; int a[N],n; int main() {IO;cin>>n;for(int i=1;i<=n;i++) cin>>a[i];ll res=1000;for(int i=1;i<=n;i++)if(i<=n&&a[i+1]>=a[i])res=res/a[i]*a[i+1]+res%a[i];cout<<res<<endl;return 0; }只能做這些容易題~~嗨,要加油哦!
總結
以上是生活随笔為你收集整理的M-SOLUTIONS Programming Contest 2020总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 为什么手机qq空间打不开
- 下一篇: 但愿人长久的下一句 但愿人长久的原文