zoukankan      html  css  js  c++  java
  • UVALive 6821 Automated Checking Machine

     题目链接:

    https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4833

    The Internet Computer Parts Company (ICPC) is an on-line shop that sells computer parts. Pairs of in-line electrical connectors are among the most popular parts that ICPC sells. However, they are also one of the parts that are returned more often by unsatisfied customers, because due to errors in packaging the connectors sent to the costumers may not be compatible.

    An in-line connector is composed of five connection points, labelled from 1 to 5. Each connection point of a connector can be either a plug or an outlet. We say two connectors are compatible if, for every label, one connection point is a plug and the other connection point is an outlet (in other words, two connectors are compatible if, for every connection point with the same label, a plug and an outlet meet when the two connectors are connected).

    The figure below shows examples of two connectors that are compatible and two connectors that are not compatible.

    ICPC is introducing a state-of-the-art Automated Checking Machine (ACM), with an optical checker, which will verify whether the two connectors packaged for a customer are indeed compati- ble. The complex and expensive hardware of the ACM is ready, but they need your help to finish the software.

    Given the descriptions of a pair of in-line connectors, your task is to determine if the connectors are compatible.

    Input

    The input contains several test cases; each test case is formatted as follows. The first line contains five integers Xi (0 ≤ Xi ≤ 1 for i = 1, 2, . . . , 5), representing the connection points of the first connector in the pair. The second line contains five integers Yi (0 ≤ Yi ≤ 1 for i = 1, 2, . . . , 5), representing the connection points of the second connector. In the input, a ‘0’ represents an outlet an a ‘1’ represents a plug.

    Output

    For each test case in the input, output a line with a character representing whether the connectors are compatible or not. If they are compatible write the uppercase letter ‘Y’; otherwise write the uppercase letter ‘N’.

    Sample Input

    11010

    00101

    10010

    10110

    Sample Output

    Y

    Hint:

    题意:

    给你几个数,让你看是不是相同,相同的话输出N,其他情况就输出Y。

    题解:

    水题,直接模拟即可。

    代码:

    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    using namespace std;
    #define met(a,b) memset(a,b,sizeof(a))
    int a[5],b[5];
    int main()
    {
        while(scanf("%d",&a[0])!=EOF)
        {
        for(int i=1;i<5;i++)
            scanf("%d",&a[i]);
        for(int i=0;i<5;i++)
            scanf("%d",&b[i]);
        int flag=1;
        for(int i=0;i<5;i++)
        {
            if(a[i]==b[i])
                flag=0;
        }
        if(flag)
            printf("Y
    ");
        else
            printf("N
    ");
        }
    }
    
  • 相关阅读:
    ASP.NET MVC中 CKeditor 通过两种方法向后台传值以及编码、乱码问题
    如何解析<textarea>标签中的html代码
    ASP.NET MVC中,后台向前台传递多个对象(表)的方法
    ASP.NET MVC 环境下CKeditor 的配置以及用jQuery进行数据存取操作
    jquery下 动态显示jqGrid 以及jqGrid的属性设置容易出现的问题
    ASP.NET MVC 中 CKeditor.js的正确引用
    关于有道词典的一个小错误
    ASP.NET MVC 标签绑定传值及后台获取并进行修改操作
    每天学点GDB 6
    每天学点GDB 9
  • 原文地址:https://www.cnblogs.com/TAT1122/p/5846441.html
Copyright © 2011-2022 走看看