对拍
xuantianhao · · 个人记录
对拍:
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main(){
for(int i=1;i<=100;i++){
system("data.exe>data.txt");
system("Floyd.exe<data.txt>Floyd.txt");
double st=clock();
system("Dijkstra.exe<data.txt>Dijkstra.txt");
double ed=clock();
if(system("fc Dijkstra.txt Floyd.txt")){printf("WA\n");break;}
else printf("AC #%d Time:%.3lfms\n",i,ed-st);
}
return 0;
}
data:
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
srand(time(0));
n=rand()%1000000+1;
return 0;
}
Dijkstra:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int n;
LL ans;
int main(){
scanf("%d",&n);
ans=n*(n+1)/2;
printf("%lld",ans);
return 0;
}
Floyd:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int n;
LL ans;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++) ans+=i;
printf("%lld",ans);
return 0;
}