zoukankan      html  css  js  c++  java
  • 校内模拟赛吧 ———— 2019.10.30

    考试时间 14:00 至 17:30

    期望得分:40+60+60

    实际得分:100+60+30

    T1:题面如下(☄⊙ω⊙)☄

    思路:最先想到的当然是暴力枚举

    然鹅,我个傻缺竟然开始从1枚举到N。。(不T才怪~)

    然后开始从N向小的枚举

    但是尽管如此依旧无法拿到60分。。(学校机子慢的一批

    then

    看到就想到需要字符读入,那么能不能直接对每个字符进行处理

    然后就这样啦

     处理一下awa

    注意如果N符合各个数位是单调不减的就直接把N输出

    还要注意先前导零的状况(awa——> @lzpclxf

    还有看好数据范围非常重要的。。。

    awa

    现在!上代码

     1 //40
     2 #include<cstdio>
     3 #include<algorithm>
     4 #include<cstring>
     5 #include<iostream>
     6 using namespace std;
     7 char a[100005];
     8 int len;
     9 int k;
    10 void awa(int k) {
    11     for(int i=1; i<k; i++)
    12         cout<<a[i];
    13     if(a[k]-'0'-1!=0)cout<<a[k]-'0'-1;
    14     for(int i=k+1; i<=len; i++)cout<<9;
    15 }
    16 int main() {
    17     freopen("increase.in","r",stdin);
    18     freopen("increase.out","w",stdout);
    19     cin>>a+1;
    20     len=strlen(a+1);
    21     k=len;
    22     for(int i=1; i<len; i++) {
    23         if(a[i]==a[i+1]) {
    24             if(a[k]==a[i])k=min(k,i);
    25             else k=i;
    26             if(a[i+1]>a[i+2]&&(i+2)<=len) {
    27                 awa(k);
    28                 fclose stdin;
    29                 fclose stdout;
    30                 return 0;
    31             }
    32         }
    33         if(a[i]>a[i+1]) {
    34             awa(i);
    35             fclose stdin;
    36             fclose stdout;
    37             return 0;
    38         }
    39     }
    40     cout<<a+1;
    41     return 0;
    42 }
    increase

    T2: ↓ 题面如下 ↓

    思路:直接暴力模拟,,,就有了60????

    代码:

    #include<cstdio>
    #include<algorithm>
    #include<iostream>
    #include<cstring>
    const long long mod=1e12+7;
    using namespace std;
    int N,a[1001];
    long long ans;
    bool flag=false;
    long long f[1001][1001];
    inline int read() {
        int s=0,w=1;
        char ch=getchar();
        while(ch<'0'||ch>'9') {
            if(ch=='-')w=-1;
            ch=getchar();
        }
        while(ch>='0'&&ch<='9')
            s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
        return s*w;
    }
    void print(long long k) {
        int num = 0;
        int ch[19];
        while(k>0) ch[++num]=k%10,k/=10;
        while(num)
            putchar(ch[num--]+48);
        putchar(32);
    }
    void awa() {
        for(int i=1; i<=N; i++)
            for(int j=i+1; j<=N; j++)
                if(a[j]<a[i])f[i][j]=a[j]*1ll*a[i]%mod;
        for(int i=1; i<=N; i++) {
            if(a[i]>=a[i-1]) {
                flag=true;
                return ;
            }
        }
    }
    int main() {
        freopen("multiplication.in","r",stdin);
        freopen("multiplication.out","w",stdout);
        N=read();
        if(N>2000)return 0;//看我对评测机多好~ 
        for(int i=1; i<=N; i++)a[i]=read();
        awa();
        if(!flag) {
            cout<<0;
            fclose stdin;
            fclose stdout;
            return 0;
        }
        for(int l=1; l<=N; l++)
            for(int r=l; r<=N; r++)
                for(int i=l; i<=r; i++)
                    for(int j=i+1; j<=r; j++)
                        ans+=f[i][j],ans%=mod;
        if(ans==0)cout<<0;
        else print(ans);
        fclose stdin;
        fclose stdout;
        return 0;
    }
    View Code

    awa我爱暴力但不会  不爱爆零却老爆

    T3:题面如下(☄⊙ω⊙)☄

    思路:自然是直接暴力求但是为何会卡掉几个点

    awa,是我太菜了

    菜鸡的代码↓

    #include<cmath>
    #include<cstdio>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    const int inf=1e9+7;
    struct node {
        int x1,y1,x2,y2;
    } f[50005];
    int T,N;
    bool flag;
    int xx1,yy1,xx2,yy2;
    inline int read();
    void awa() {
        bool col[405][405];
        memset(col,false,sizeof col);
        for(int i=1; i<=N; i++)
            for(int x=f[i].x1+200; x<f[i].x2+200; x++)
                for(int y=f[i].y1+200; y<f[i].y2+200; y++) {
                    if(col[x][y]) {
                        cout<<"Guguwansui"<<"
    ";
                        return;
                    }
                    col[x][y]=true;
                }
        for(int i=xx1+200; i<xx2+200; i++)
            for(int j=yy1+200; j<yy2+200; j++)
                if(!col[i][j]) {
                    cout<<"Guguwansui"<<"
    ";
                    return;
                }
        cout<<"Perfect"<<"
    ";
        return;
    }
    bool check(int a,int b) {
        if(f[a].x1<f[b].x1&&f[a].y1<f[b].y1&&f[a].y2>f[b].y1&&f[a].x2>f[b].x1) return false;
        if(f[a].x1<f[b].x1&&f[a].x2>f[b].x1&&f[a].y1<f[b].y2&&f[a].y1>f[b].y1)return false;
        return true;
    }
    void qwq() {
        for(int i=1; i<N; i++)
            for(int j=i+1; j<=N; j++)
                if(!check(i,j)||!check(j,i)) {
                    cout<<"Guguwansui"<<'
    ';
                    return;
                }
        cout<<"Perfect"<<"
    ";
        return;
    }
    int main() {
        freopen("matrix.in","r",stdin);
        freopen("matrix.out","w",stdout);
        T=read();
        while(T--) {
            xx1=inf,xx2=-inf,yy1=inf,yy2=-inf;
            flag=true;
            N=read();
            for(int i=1; i<=N; i++) {
                f[i].x1=read(),f[i].y1=read(),f[i].x2=read(),f[i].y2=read();
                if(abs(f[i].x1)>200||abs(f[i].x2)>200||abs(f[i].y1)>200||abs(f[i].y2)>200) flag=false;
                xx1=min(xx1,f[i].x1),xx2=max(xx2,f[i].x2),yy1=min(yy1,f[i].y1),yy2=max(yy2,f[i].y2);
            }
            if(flag) {
                awa();
                continue;
            }
            qwq();
        }
        fclose stdin;
        fclose stdout;
        return 0;
    }
    inline int read() {
        int s=0,w=1;
        char ch=getchar();
        while(ch<'0'||ch>'9') {
            if(ch=='-')w=-1;
            ch=getchar();
        }
        while(ch>='0'&&ch<='9')
            s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
        return s*w;
    }
    View Code

     要到了大佬的代码

    %%%%%%%%%%%%%

    wxyww tql Orz Sto

  • 相关阅读:
    数据库连接池的作用及c3p0的详解(转载他人的--合理掌握学习方式)
    JAVA读取propertise文件内容两种方式(起始还是有很多种的)
    servlet--生命周期
    UML学习(三)-----序列图
    UML学习(一)-----用例图
    UML学习(二)-----类图
    Java静态域与静态方法
    spring boot启动原理三(结合web容器,如:tomcat(默认),jetty)
    spring源码相关第五篇----------------------------spring tx实现原理源码解读
    spring源码相关第四篇----------------------------spring aop实现原理源码解读
  • 原文地址:https://www.cnblogs.com/ydclyq/p/11767174.html
Copyright © 2011-2022 走看看