对拍

Falling_Sakura

对拍

参考:参考文章1 参考文章2

数据

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<bits/stdc++.h>
#include<sys/timeb.h>
using namespace std;
typedef long long ll;

ll Rand(ll mod)
{
ll ans = INT_MAX;
return ans * rand() % mod + 1;
}

int main()
{
struct _timeb T;
_ftime(&T);
srand(T.millitm); // T.millitm 为毫秒级随机数的种子
mt19937 rd(T.millitm);
ofstream file;
file.open("a.in");
int a = rd(), b = rd();
file << a << ' ' << b;
file.close();
return 0;
}

或者:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<bits/stdc++.h>
#include<sys/timeb.h>
using namespace std;
typedef long long ll;

ll Rand(ll mod)
{
ll ans = INT_MAX;
return ans * rand() % mod + 1;
}

int main()
{
struct _timeb T;
_ftime(&T);
srand(T.millitm);
mt19937 rd(T.millitm);
freopen("a.in","w",stdout);
int a = rd(), b = rd();
cout << a << ' ' << b;
return 0;
}

暴力

1
2
3
4
5
6
7
8
9
10
11
#include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("a.in", "r", stdin);
freopen("a.out", "w", stdout);
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", a + b);
return 0;
}

待测

1
2
3
4
5
6
7
8
9
10
11
#include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("a.in", "r", stdin);
freopen("a.ans", "w", stdout);
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", a + b);
return 0;
}

对拍

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<bits/stdc++.h>
using namespace std;
int main()
{
int ok = 0;
int n = 20;
system("cd E:/CodeProgram/CPP/Makers/Test/&g++ std.cpp -o std.exe&g++ baoli.cpp -o baoli.exe&g++ make.cpp -o make.exe");
for(int i = 1; i <= n; i++)
{
system("cd E:/CodeProgram/CPP/Makers/Test/&make.exe&baoli.exe");
double begin = clock();
system("cd E:/CodeProgram/CPP/Makers/Test/&std.exe");
double end = clock();
double t = end - begin;
if(system("cd E:/CodeProgram/CPP/Makers/Test/&fc a.out a.ans"))
{
printf("测试点 #%d Wrong Answer\n",i);
fstream file;
int a, b ;
file.open("E:/CodeProgram/CPP/Makers/Test/a.in");
if(file.good() && file.is_open())
file >> a >> b;
printf("输入:%d %d\n\n", a, b);
file.close();
}
else if(t > 1000)
{
printf("测试点 #%d Time Limited Exeeded 用时 %.1fms\n\n", i, t);
}
else
{
printf("测试点 #%d Accepted 用时 %1.lfms\n\n", i, t);
ok++;
}
printf("-------------------------------\n\n");
}
puts("");
double res = 100.0 * ok / n;
printf("共 %d 组测试数据,AC 数据 %d 组,得分:%.1lf。\n", n, ok, res);
return 0;
}
  • Title: 对拍
  • Author: Falling_Sakura
  • Created at : 2023-09-03 12:27:19
  • Updated at : 2025-10-13 15:09:51
  • Link: https://vercel.fallingsakura.top/835730ca.html
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments