快读
int read()
{
char c;
int f=1;
ll x=0;
c=getchar();
while(c<'0'||c>'9')
{
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=x*10+(c-'0');
c=getchar();
}
return f*x;
}
对拍
扩展名:.bat
:loop
gen.exe//随机生成数据
live_bf.exe//暴力程序
live_corr.exe//正解
fc live.out live.ans
if not errorlevel 1 goto loop
随机生成数据
srand(time(0))
rand()
头文件:
#include<stdlib.h>
#include<time.h>
完整代码:
#include<iostream>
#include<cstdio>
#include<stdlib.h>
#include<time.h>
using namespace std;
int main()
{
srand(time(0));
int n=100;
freopen("live.in","w",stdout);
int w=rand()%101;
cout<<n<<' '<<w<<endl;
for(int i=1;i<=n;i++)
{
int a=rand()%601;
cout<<a<<' ';
}
}
cin,cout关闭同步流
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
dev-c 开c14和O2优化
工具-编译选项-编译时加入以下命令√
-std=c++14 -O2