Description
It is difficult to consider the questions. At the same time, to encourage the students to continue their exercises, we will put this question today...
Previously written, just put the code. If you go back to the students you have not done, remember to think about the questions you cannot do next time.
It is necessary to judge that two pieces of code are plagiarized. However, there seems to be no good way to judge them ......
A better method is to compare the compiled binary files.
Now let you write a program to compare the differences between the two binary files.
-
Input
-
The first line contains 1 integer T, indicating that there are T groups of data.
Each group of data contains two rows.
The first line contains a number N1 (<= 1000) indicating the length, a space character, and an array of '0' and '1' characters whose length is N1, indicates the information of the first file.
The structure of the second line is similar to that of the first line. The length is N2 (<= 1000 ).
-
Output
-
Determine the similarity between two 1-0 strings. If the length is different, it must be different. If the length is the same, count the numbers of characters at the same position, if it takes more than 70% of the total length, it indicates that plagiarism is suspected, that is
(Same number of characters)/(character array length)> = 0.700 (precise to 3 digits after the decimal point ).
If plagiarism is suspected, yes is output; otherwise no is output.
Simple comparison
#include<stdio.h>main(){int te,number;int temp1,temp2;int i,j;double result;double count;char a[1000],b[1000];scanf("%d",&number);for (te=1;te<=number;te++){ count=0; result=0;scanf("%d %s",&temp1,&a);getchar();scanf("%d %s",&temp2,&b);getchar();if(temp1!=temp2)printf("No\n");else{ for(i=0;i<temp1;i++){ if(a[i]==b[i])count++;}result=count/temp1;if(result>=0.700)printf("Yes\n");elseprintf("No\n");} }}