zoukankan      html  css  js  c++  java
  • 2015南阳CCPC A

    D. Duff in Beach

    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

    题意

          给你两个2*2的矩阵,判断一个旋转是否能得到另外一个

    题解:

        模拟不多说

    ///1085422276
    #include<bits/stdc++.h>
    using namespace std ;
    typedef long long ll;
    #define mem(a) memset(a,0,sizeof(a))
    #define meminf(a) memset(a,127,sizeof(a))
    #define TS printf("111111
    ")
    #define FOR(i,a,b) for( int i=a;i<=b;i++)
    #define FORJ(i,a,b) for(int i=a;i>=b;i--)
    #define READ(a,b,c) scanf("%d%d%d",&a,&b,&c)
    #define inf 100000
    inline ll read()
    {
        ll x=0,f=1;
        char ch=getchar();
        while(ch<'0'||ch>'9')
        {
            if(ch=='-')f=-1;
            ch=getchar();
        }
        while(ch>='0'&&ch<='9')
        {
            x=x*10+ch-'0';
            ch=getchar();
        }
        return x*f;
    }
    //****************************************
    
    int main()
    {
        int oo=1;
        int a[6],b[5];
         int T=read();
         while(T--){
            for(int i=1;i<=4;i++){
    
                scanf("%d",&b[i]);
    
            }
            for(int i=1;i<=4;i++){
    
                scanf("%d",&a[i]);
    
            }
            bool flag=0;
            if(b[1]==a[1]&&b[2]==a[2]&&b[3]==a[3]&&b[4]==a[4]){
               flag=1;
            }
            if(a[3]==b[1]&&a[1]==b[2]&&a[2]==b[4]&&a[4]==b[3]){
                flag=1;
            }
             if(a[4]==b[1]&&a[3]==b[2]&&a[1]==b[4]&&a[2]==b[3]){flag=1;}
             if(a[2]==b[1]&&a[4]==b[2]&&a[3]==b[4]&&a[1]==b[3]){flag=1;}
            printf("Case #%d: ",oo++);
            if(flag){
                cout<<"POSSIBLE"<<endl;
            }
            else {
                cout<<"IMPOSSIBLE"<<endl;
            }
         }
        return 0;
    }
    代码
  • 相关阅读:
    城市社会经济专项规划之生态产业规划
    土地资源承载力研究
    生态功能区划方法之三:聚类分析法和生态融合法
    生态功能区划综述
    生态功能区划及生态规划的重要内容:生态环境现状评价
    生态功能区划方法之一:生态敏感性分析法
    生态环境专项规划
    城市社会经济专项规划之生态人居规划
    城市生态规划关键技术方法之五:生态支持系统瓶颈分析方法
    环境容量研究
  • 原文地址:https://www.cnblogs.com/zxhl/p/4924227.html
Copyright © 2011-2022 走看看