天天看点

关于对pei

别惹我,惹急了我什么都做的出来,除了数学题

我现在才开始整理这个不算晚吧......

望轻喷

学习博客

我们需要四个程序

1.暴力

2.“正解”

3.数据生成器

4.检查程序

暴力:

就是暴力

eg:

#include <cstdio>
#include <iostream>
using namespace std;  
int main() { 
    int a, b;  
    cin >> a >> b; 
    cout << a + b << endl; 
    return 0;  
}      

正解:

你觉得挺对的程序

#include <cstdio>
#include <iostream>
int main() {
    int a, b;
    scanf("%d %d",&a, &b);
    printf("%d\n", a + b);
    return 0;
}      

随机数:

#include <bits/stdc++.h>

using namespace std;

int main()

{

srand(time(0));

int a,b;

a=rand()%100+1,b=rand()%100+1;

printf("%d %d\n",a,b);

return 0;

}

检查程序:

checker.bat

:again
data.exe > input.txt
biaoda.exe < input.txt > biaoda_output.txt
test.exe < input.txt > test_output.txt
fc biaoda_output.txt test_output.txt
if not errorlevel 1 goto again
pause      

谢谢收看,祝身体健康!