zoukankan      html  css  js  c++  java
  • 洛谷P3952 时间复杂度

    这是一道蓝色的蓝色的蓝色的模拟题!!!变态的不能再变态的模拟题,LITTLESUN太菜了写了整整一天,整整一天,整整一天也没写出来,决定先暂时放一放占一个坑好了。

    百分之三十的分还是很好骗的,先把代码放这吧。

    (这个骗了36分)

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    #define MAXN 10010
    using namespace std;
    char G[MAXN];
    int sign[MAXN];
    int main()
    {
        int t;
        scanf("%d",&t);
        for(int i=1;i<=t;i++)
        {
            int L;
            scanf("%d",&L);
            scanf("%s",G);
            int ans=1,w1;
            if(G[2]>='0'&&G[2]<='9')
            {
                sign[ans]=1;
                ans++;
                w1=0;
            }
            else if(G[2]>='a'&&G[2]<='z')
            {
                sign[ans]=2;
                ans++;
                w1=G[4]-'0';
            }
            int vis=0;
            int w2,mx=0;
            for(int j=1;j<=L;j++)
            {
                char op1;
                cin>>op1;
                if(op1=='F')
                {
                    char op2;
                    int op3;
                    string op4;
                    cin>>op2>>op3>>op4;
                    if(op4[0]>='a'&&op4[0]<='z')
                    {
                        if(vis==3||vis==0)
                        {
                            sign[ans]=2;
                            ans++;
                        }
                        else
                        {
                            for(int j=2;j<ans;j++)
                            {
                                if(sign[j]==2)
                                {
                                    w2++;
                                }
                            }
                            if(w2>=mx)
                            {
                                mx=w2;
                                w2=0;
                            }
                            sign[2]=2;
                            for(int k=3;k<ans;k++)
                            {
                                sign[k]=0;
                                ans=3;
                            }
                        } 
                    }
                    else
                    {
                        sign[ans]=1;
                        ans++;    
                    }
                }
                if(op1=='E')
                {
                    vis=4;
                }
            }
            for(int j=2;j<ans;j++)
            {
                if(sign[j]==2)
                {
                    w2++;
                }
            }
            if(w2>=mx)
            {
                mx=w2;
                w2=0;
            }
            //cout<<"mx="<<mx;
            //cout<<"w1="<<w1; 
            if(mx==w1)
            {
                printf("Yes
    ");
            }
            else
            {
                printf("No
    ");
            }
        }
        return 0;
    }

     ```

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    #include<vector>
    #define MAXN
    using namespace std;
    int n;
    char a[MAXN];
    vector<int> fxl;
    int main()
    {
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
        scanf("%d",&n);
        while(n--)
        {
            scanf("%d",&L);
            int num1=0,num2=0,cnt1++,cnt2++;
            bool hhh1=0,hhh2=0;
            int now=0;
            for(int i=1;i<=L;i++)
            {
                memset(a,0,sizeof(a));
                scanf("%s",a);
                if(a[2]=='n')
                {
                    hhh1=1;
                    num1=a[4]^48;
                }
                else if(a[2]=='1')
                {
                    num1=a[2]^48;
                }
                memset(a,0,sizeof(a));
                scanf("%s",a);
                
                if(a[0]=='F')
                {
                    if(a[3]=='n')
                    {
                        hhh2=1;
                        cnt1++;
                    }
                    int tou=a[1]^48;
                    fxl.push_back(tou);
                    if(now>=1)
                    {
                        for(int i=0;i<=now;i++)
                        {
                            if(a[i]==a[now])
                            {
                                printf("ERR ");
                                return 0;
                            }
                        }
                    }
                }
                else if(a[0]=='E')
                {
                    cnt2++;
                    fxl.pop_back();
                }
            }
            if(cnt1!=cnt2) printf("ERR ");
            
        }
        return 0;
    }

    ```

  • 相关阅读:
    湘潭大学 Hurry Up 三分,求凹函数的最小值问题
    hdu 1166 线段树 单点修改 + 询问区间求和 (线段树模板)
    hdu 1166 树状数组(模板) 更改点值+求区间和
    getline
    poj 1873 The Fortified Forest 凸包+位运算枚举 world final 水题
    C# 代码操作XML(增、删、改)
    C# Socket服务端与客户端通信(包含大文件的断点传输)
    MD5 十六进制加密
    C# 面向对象——多态
    C# 面向对象——继承
  • 原文地址:https://www.cnblogs.com/LITTLESUNwl/p/10647341.html
Copyright © 2011-2022 走看看