当前位置: 移动技术网 > 移动技术>移动开发>IOS > M-SOLUTIONS Programming Contest 2020总结

M-SOLUTIONS Programming Contest 2020总结

2020年07月27日  | 移动技术网移动技术  | 我要评论
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;

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;
}

只能做这些容易题~~嗨,要加油哦!

本文地址:https://blog.csdn.net/Fighting_Peter/article/details/107594942

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网