• 2015南阳CCPC A


    D. Duff in Beach

    Time Limit: 1 Sec  

    Memory Limit: 256 MB

    题目连接

    Description

    Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. The plan instructs how to deploy soldiers on the four corners of the city wall. Unfortunately, when Fei opened the pocket he found there are only four numbers written in dots on a piece of sheet. The numbers form a 2×2 matrix, but Fei didn't know the correct direction to hold the sheet. What a pity!

    Given two secrete master plans. The first one is the master's original plan. The second one is the plan opened by Fei. As KongMing had many pockets to hand out, he might give Fei the wrong pocket. Determine if Fei receives the right pocket.

    title

    Input

    The first line of the input gives the number of test cases, T(1T104). T test cases follow. Each test case contains 4 lines. Each line contains two integers ai0 and ai1 (1ai0,ai1100). The first two lines stands for the original plan, the 3rd and 4th line stands for the plan Fei opened.

    Output

    For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is either "POSSIBLE" or "IMPOSSIBLE" (quotes for clarity).

    Sample Input

    4
    1 2
    3 4
    1 2
    3 4
    
    1 2
    3 4
    3 1
    4 2
    
    1 2
    3 4
    3 2
    4 1
    
    1 2
    3 4
    4 3
    2 1

    Sample Output

    Case #1: POSSIBLE Case #2: POSSIBLE Case #3: IMPOSSIBLE Case #4: POSSIBLE

    HINT

    题意

    给你俩2*2的矩阵,问你能不能通过旋转从第一个得到第二个

    题解:

    暴力转圈圈就好了

    代码:

    #include<iostream>
    #include<stdio.h>
    using namespace std;
    
    
    int a[4][4];
    int b[4][4];
    int c[4][4];
    int check()
    {
        if(a[1][1]==b[1][1]&&a[1][2]==b[1][2]&&a[2][1]==b[2][1]&&a[2][2]==b[2][2])
            return 1;
        if(a[1][2]==b[1][1]&&a[2][2]==b[1][2]&&a[1][1]==b[2][1]&&a[2][1]==b[2][2])
            return 1;
        if(a[2][2]==b[1][1]&&a[2][1]==b[1][2]&&a[1][2]==b[2][1]&&a[1][1]==b[2][2])
            return 1;
        if(a[2][1]==b[1][1]&&a[1][1]==b[1][2]&&a[2][2]==b[2][1]&&a[1][2]==b[2][2])
            return 1;
        return 0;
    }
    int main()
    {
        int t;scanf("%d",&t);
        for(int cas = 1;cas <= t;cas++)
        {
            for(int i=1;i<=2;i++)
                for(int j=1;j<=2;j++)
                    scanf("%d",&a[i][j]);
            for(int i=1;i<=2;i++)
                for(int j=1;j<=2;j++)
                    scanf("%d",&b[i][j]);
            if(check())
                printf("Case #%d: POSSIBLE
    ",cas);
            else
                printf("Case #%d: IMPOSSIBLE
    ",cas);
        }
    }
  • 相关阅读:
    shell 操作钉钉机器人实现告警提醒
    谨慎 mongodb 关于数字操作可能导致类型及精度变化
    数据库如何应对保障大促活动
    SQL Server Alwayson架构下 服务器 各虚拟IP漂移监控告警的功能实现 -1(服务器视角)
    通过 Telegraf + InfluxDB + Grafana 快速搭建监控体系的详细步骤
    MySQL数据库Inception工具学习与测试 笔记
    MongoDB 中数据的替换方法实现 --类Replace()函数功能
    MongoDB 中的【加减乘除】运算
    MySQL索引设计需要考虑哪些因素?
    关于SQL Server 数据库归档的一些思考和改进
  • 原文地址:https://www.cnblogs.com/qscqesze/p/4899317.html
Copyright © 2020-2023  润新知