zoukankan      html  css  js  c++  java
  • Codeforces Round #412

    第一题水题,8分钟1a

    #include<map>
    #include<set>
    #include<cmath>
    #include<queue>
    #include<stack>
    #include<vector>
    #include<cstdio>
    #include<cassert>
    #include<iomanip>
    #include<cstdlib>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    #define pi acos(-1)
    #define ll long long
    #define mod 1000000007
    #define ls l,m,rt<<1
    #define rs m+1,r,rt<<1|1
    #pragma comment(linker, "/STACK:1024000000,1024000000")
    
    using namespace std;
    
    const double g=10.0,eps=1e-9;
    const int N=1000000+10,maxn=5000+10,inf=0x3f3f3f3f;
    
    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        int n;
        cin>>n;
        int last;
        bool maybe=0,rate=0;
        for(int i=0;i<n;i++)
        {
            int a,b;
            cin>>a>>b;
            if(i==0)last=a;
            else
            {
                if(last<a)maybe=1;
                last=a;
            }
            if(a!=b)rate=1;
        }
        if(rate)cout<<"rated"<<endl;
        else if(!rate&&maybe)cout<<"unrated"<<endl;
        else if(!rate&&!maybe)cout<<"maybe"<<endl;
        return 0;
    }
    A

    第二题暴力模拟一下,每次加(减)50,先减再加

    #include<map>
    #include<set>
    #include<cmath>
    #include<queue>
    #include<stack>
    #include<vector>
    #include<cstdio>
    #include<cassert>
    #include<iomanip>
    #include<cstdlib>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    #define pi acos(-1)
    #define ll long long
    #define mod 1000000007
    #define ls l,m,rt<<1
    #define rs m+1,r,rt<<1|1
    #pragma comment(linker, "/STACK:1024000000,1024000000")
    
    using namespace std;
    
    const double g=10.0,eps=1e-9;
    const int N=1000000+10,maxn=5000+10,inf=0x3f3f3f3f;
    
    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        int p,x,y,ans=0;
        cin>>p>>x>>y;
        for(int i=x;i>=y;i-=50)
        {
            int j=(i/50)%475;
            for(int k=1;k<=25;k++)
            {
                j=(j*96+42)%475;
                if(j+26==p)
                {
                    ans=i;
                    break;
                }
            }
            if(ans)break;
        }
        if(ans)
        {
            cout<<0<<endl;
            return 0;
        }
        for(int i=x;;i+=50)
        {
            int j=(i/50)%475;
            for(int k=1;k<=25;k++)
            {
                j=(j*96+42)%475;
                if(j+26==p)
                {
                    ans=i;
                    break;
                }
            }
            if(ans)break;
        }
        int res=(ans-x+50)/100;
        cout<<res<<endl;
        return 0;
    }
    B

    第三题wa了6发,终于O(1)过了,数据1e9早该想到算法有问题

    #include<map>
    #include<set>
    #include<cmath>
    #include<queue>
    #include<stack>
    #include<vector>
    #include<cstdio>
    #include<cassert>
    #include<iomanip>
    #include<cstdlib>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    #define pi acos(-1)
    #define ll long long
    #define mod 1000000007
    #define ls l,m,rt<<1
    #define rs m+1,r,rt<<1|1
    #pragma comment(linker, "/STACK:1024000000,1024000000")
    
    using namespace std;
    
    const double g=10.0,eps=1e-9;
    const int N=1000000+10,maxn=5000+10,inf=0x3f3f3f3f;
    
    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        ll x,y,p,q;
        int t;
        cin>>t;
        while(t--){
            cin>>x>>y>>p>>q;
            if(p==q)
            {
                if(x==y)cout<<0<<endl;
                else cout<<-1<<endl;
                continue;
            }
            if(p==0)
            {
                if(x==0)cout<<0<<endl;
                else cout<<-1<<endl;
                continue;
            }
            ll k1=(y-x)/(q-p);
            if((y-x)%(q-p)!=0)k1++;
            ll k2=x/p;
            if(x%p!=0)k2++;
            ll k3=y/q;
            if(y%q!=0)k3++;
            ll k=max(k1,max(k2,k3));
            cout<<k*q-y<<endl;
        }
        return 0;
    }
    C
  • 相关阅读:
    [转]开发者最容易犯的13个JavaScript错误
    http状态码表
    RDLC报表部署到服务器的相关问题
    sharepoint权限集中管理工具
    依赖注入
    HttpModule & HttpHandle
    回滚事务
    HTTPMOUDLE 和httphandler 学习
    JavaScript操作Table
    .ne工具库
  • 原文地址:https://www.cnblogs.com/acjiumeng/p/7161033.html
Copyright © 2011-2022 走看看