zoukankan      html  css  js  c++  java
  • P7042 「MCOI-03」正方

    Aimee

    很简单的一个小题

    分类讨论啊
    --scz

    #include<iostream>
    #include<algorithm>
    #include<cstdio>
    #define int long long
    using namespace std;
    int q;
    int len[5];
    signed main(){
    	scanf("%lld",&q);
    	for(int i=1;i<=q;++i){
    		scanf("%lld%lld%lld%lld",&len[1],&len[2],&len[3],&len[4]);
    		sort(len+1,len+4+1);
    		if(len[1]+len[4]!=len[2]+len[3]){
    			cout<<0<<endl;
    			continue;
    		}
    		if(len[1]==len[2]&&len[2]==len[3]&&len[3]==len[4]){
    		cout<<1<<endl;
    		}else{
    			if(len[1]==len[2]&&len[3]==len[4]){
    				cout<<4<<endl;
    			}else{
    				if(len[1]==len[2]||len[3]==len[4]){
    					cout<<2<<endl;
    				}else{
    					if(len[1]+len[4]==len[2]+len[3]){
    						cout<<8<<endl;
    					}else{
    						cout<<0<<endl;
    					}
    				}
    			}
    		} 
    	}
    	return 0;
    }
    
    
  • 相关阅读:
    Web.xml配置详解
    ANNOTATION 注解
    Gradle的使用
    Version Control
    Building Tool(Maven/Gradle)
    HTTP协议
    函数式编程
    injection
    Container
    Building Tool(Maven/Gradle)
  • 原文地址:https://www.cnblogs.com/For-Miku/p/13908059.html
Copyright © 2011-2022 走看看