自动AC机

· · 个人记录

自动AC机是个臭名昭著的东西,但写自动AC机个人认为有助提升对于string的理解。 仅供学习,请勿在任何时候使用! 所以请您高抬贵手,Thanks♪(・ω・)ノ! 主程序:

#include<bits/stdc++.h>
#define MAXX (9999)
using namespace std;string a="edit";char b[1000],c[1000];//edit为题目名称 
void hhh(){
    gets(b);
    a+=b[0];
    a+=".out";
    for(int i=0;i<a.length();i++){
        b[i]=a[i];  
        cout<<b[i];
        b[i+1]='\0';    
    }


}
int main(){
    system("start 未命名2.exe");//捆绑软件名称 
    freopen("x.txt","r",stdin);//计数文件名:x.txt,记得将其设为一 
    hhh();
    freopen(b,"r",stdin);
    gets(c);
    freopen("edit.out","w",stdout);
    int i,j;
    for(i=0;i<strlen(c);i++){
        cout<<c[i];
    }


    fclose(stdin);
    fclose(stdout);
    return 0;
}

捆绑程序

#include<bits/stdc++.h>//捆绑软件,作用是计数 
#define MAXX (9999)
using namespace std;    int i,j,a;
int main(){
    freopen("x.txt","r",stdin);cin>>a;
  freopen("x.txt","w",stdout);
    cout<<a+1;
    fclose(stdin);
    fclose(stdout);
    return 0;
}

————————————————————————-

这个是弱化版的,毕竟一直闪也会被发现 强化版:

#include<bits/stdc++.h>
#define MAXX (9999)
using namespace std;
string a="edit";
char b[1000],c[1000];int b1,b2;//edit为题目名称
void hhh() {
    cin>>b1;
    freopen("x.txt","w",stdout);
    cout<<b1+1;
    freopen("edit.out","w",stdout);
    b[0]=b1+'0';
    a+=b[0];
    a+=".out";
    cout<<b[0]<<"\n";
    cout<<a;
    for(int i=0; i<a.length(); i++) {
        b[i]=a[i];
        b[i+1]='\0';
    }

}
int main() {

    freopen("x.txt","r",stdin);//计数文件名:x.txt,记得创建并将其设为0

    hhh();

    freopen(b,"r",stdin);
    gets(c);
    freopen("edit.out","w",stdout);
    int i,j;
    for(i=0; i<strlen(c); i++) {
        cout<<c[i];
    }

    fclose(stdin);
    fclose(stdout);
    return 0;
}

全自动强化版:

#include<bits/stdc++.h>
#define MAXX (9999)
using namespace std;
string a="sum",s,z;
char b[1000],e,c[1000];
char* d;
int b1=99,b2;//sum为题目名称
void hhh() {
    cin>>b1;
    if(b1==99) {
        if(freopen("sum0.out","r",stdin)==NULL) {
            freopen("x.txt","w",stdout);
            cout<<2;

            b1=1;
        } else {
            freopen("x.txt","w",stdout);
            cout<<1;
            b1=0;
        }
    } else {
        freopen("x.txt","w",stdout);
        b2=b1+1;
        cout<<b2;
    }

    s+=a;
//  cout<<b1;
    freopen("sum.out","w",stdout);
    if(b1<=9) {
        b[0]=b1+'0';
        if(b1==9) {
            b2=10;
            s+=1+'0';
            s+=0+'0';

        } else {
            s+=b[0]+1;
        }

        a+=b[0];
        s+=".out";const char *p=s.data();
        a+=".out";
        for(int i=0; i<a.length(); i++) {
            b[i]=a[i];
            b[i+1]='\0';
        }

    } else {
        b[0]=b1/10+'0';
        b[1]=b1%10+'0';
        s+=b[0];
        s+=b[1]+1;
        a+=b[0];
        a+=b[1];
        a+=".out";
        s+=".out";
        const char *p=s.data();
        for(int i=0; i<a.length(); i++) {
            b[i]=a[i];
            b[i+1]='\0';
        }
    }
}
int main() {

    if(freopen("sum.cpp","r",stdin)==NULL) {
        b1=1;
        b[0]=b1+'0';
        s+=b[0];
        a+=b[0];
        s+=".out";
        a+=".out";
        for(int i=0; i<a.length(); i++) {
            b[i]=a[i];
            b[i+1]='\0';
        }
        freopen(b,"r",stdin);
        gets(c);
        const char *p=s.data();
        freopen("sum.out","w",stdout);
        int i,j;
        for(i=0; i<strlen(c); i++) {
            cout<<c[i];
        }
        return 0;
    } else {
//      SetFileAttributes("x.txt", FILE_ATTRIBUTE_NORMAL);
        freopen("x.txt","r",stdin);//计数文件名:x.txt.现在为全自动,不用手动。
//         SetFileAttributes("x.txt",FILE_ATTRIBUTE_HIDDEN );
        hhh();
        freopen(b,"r",stdin);
        gets(c);
        freopen("sum.out","w",stdout);
        int i,j;
        for(i=0; i<strlen(c); i++) {
            cout<<c[i];
        }
        const char *p1=s.data();
        if(freopen(p1,"r",stdin)==NULL) {
            system("del /q x.txt");
            system("del /q sum.cpp");
            fclose(stdout);
            system("del /q sum.out");
            //freopen("sum.out","w",stdout);
            //销毁文件请将以上三行的注释去掉
        }
        fclose(stdin);
        fclose(stdout);
        return 0;
    }
}
//现在只需要使用替换将文件名替换即可,修复了一个bug。