1355 code plagiarism

Source: Internet
Author: User
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");} }}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.