1.cpp1
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
int t;scanf("%d",&t);while(t>0){t--;long double a,b,x,y;
scanf("%llf%llf%llf%llf",&a,&b,&x,&y);if(a<0)a=-a;if(b<0)b=-b;
if(a==0&&b==0){
if(x==y&&x==0)printf("Y\n");else{
printf("N\n");
}
}else if(a==0||b==0){
if(a==0&&x/b==(int)(x/b)&&y/b==(int)(y/b)){
printf("Y\n");
}else if(b==0&&x/a==(int)(x/a)&&y/a==(int)(y/a)){
printf("Y\n");
}else{
printf("N\n");
}
}else if(a==b){
if(x==y&&x/a==(int)(x/a)){
printf("Y\n");
}else{
printf("N\n");
}
}else if(a!=0&&b!=0){
long double f=(b*y-a*x)/(b*b-a*a);
if(f==(int)f){
f=(x-f*a)/b;if(f==(int)f){
printf("Y\n");
}else{
printf("N\n");
}
}else{
printf("N\n");
}
}
}
}
2.cpp2
3.数据生成器
#include<bits/stdc++.h>
#include<ctime>
#include<cstdlib>
using namespace std;
int main(){
srand(time(NULL));int t=1;
printf("%d\n",t);int i;
for(i=1;i<=t;i++){
printf("%d %d %d %d\n",rand()%10,rand()%10,rand()%10,rand()%10);
}
}
4.
比较程序:
#include<cstdio>
#include<iostream>
#include<windows.h>
using namespace std;
int main(){int t=10000;
while(t>0){t--;
system("date.exe > date.txt");
system("cpp1.exe < date.txt > cpp1.txt");
system("cpp2.exe < date.txt > cpp2.txt");
if(system("fc cpp2.txt cpp1.txt")){
printf("!!!!!!\n");break;
}
}
}