天天看點

關于對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      

謝謝收看,祝身體健康!