Uva340 after understanding the meaning of the question

Source: Internet
Author: User

An incorrect understanding of the meaning of the question. It should be a game. Only one set of answer sequences are input, and multiple groups of test sequences are input, the previous misunderstanding is that each input corresponds to a set of answer sequences and a set of test sequences. The following is the code after understanding the question, but it is still wa, to be modified.

#include<stdio.h>#define maxn 1010int main(){    int num,a[maxn],i,j,b[maxn];    int sum=0;    while(scanf("%d",&num)!=EOF&&num)    {    ++sum;    printf("Game %d:\n",sum);for(i=0;i<num;i++)        {            scanf("%d",&a[i]);                    }                for(;;)        {int s1=0,s2=0;for(i=0;i<num;i++)        {            scanf("%d",&b[i]);            if(a[i]==b[i])            {            s1++;            }        }        if(b[0]==0){break;        }        int c1=0,c2=0;        for(int d=0;d<10;d++)        {        for(i=0;i<num;i++)        {        if(a[i]==d) c1++;        if(b[i]==d) c2++;        }        }        if(c2>c1) s2+=c1;        else s2+=c2;       printf("   (%d,%d)\n",s1,s2-s1);}    }}


Uva340 after understanding the meaning of the question

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.