zoukankan      html  css  js  c++  java
  • 题解 CF1360A 【Minimal Square】

    这题没什么好讲的吧= =

    大概就是只有 (2) 种不同的放置方法:

    一种是 (a)(2 * b) 放一边

    另一种是 (2 * a)(b) 放一边

    输出 (min(max(a * 2, b), max(a, b * 2)) * min(max(a * 2, b), max(a, b * 2))) 即可

    #include <algorithm>
    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <string>
    #include <cmath>
    #include <map>
    #define N 1010
    #define M 5000010
    #define ls x << 1
    #define rs x << 1 | 1
    #define inf 0x3f3f3f3f
    #define inc(i) (++ (i))
    #define dec(i) (-- (i))
    #define mid ((l + r) >> 1)
     #define int long long
    //#define ll long long
    #define XRZ 10000000000000
    #define pai acos(-1)
    #define debug() puts("XRZ TXDY");
    #define mem(i, x) memset(i, x, sizeof(i));
    #define Next(i, u) for(register int i = head[u]; i ; i = e[i].nxt)
    #define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout);
    #define Rep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
    #define Dep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
    using namespace std;
    inline int read() {
        register int x = 0, f = 1; register char c = getchar();
        while(c < '0' || c > '9') {if(c == '-') f = -1;c = getchar();}
        while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar(); 
        return x * f;
    }
    int dx[10] = {0, 1, 1, 2, 2, -1, -1, -2, -2};
    int dy[10] = {0, 2, -2, 1, -1, 2, -2, 1, -1};
    
    signed main() { int T = read();
    	while(T --) { int a = read(), b = read();
    		printf("%d
    ", min(max(a * 2, b), max(a, b * 2)) * min(max(a * 2, b), max(a, b * 2)));
    	}
    	return 0;
    }
    
  • 相关阅读:
    ["Visual Studio快捷键" ,"Vs","IDEA快捷键"]
    文件夹
    x
    软考.第一章-信息化和信息系统
    软考.起航篇
    Global.asax.cs 为 /.aspx 执行子请求时出错。 Server.Transfer
    网关我选 Spring Cloud Gateway
    我面向 Google 编程,他面向薪资编程
    JDK 13 都已经发布了,Java 8 依然是最爱
    Spring Cloud 系列之 Spring Cloud Stream
  • 原文地址:https://www.cnblogs.com/Flash-plus/p/13834269.html
Copyright © 2011-2022 走看看