欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

M-SOLUTIONS Programming Contest 2020总结

程序员文章站 2024-01-09 20:13:10
A - Kyu in AtCoder直接模拟#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)#define debug(x) cout<<#x<<": "<#includeusing 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