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;
    }
    
  • 相关阅读:
    机器学习分类
    12.python中高阶函数以及内建函数(map,filter,sorted),和闭包
    python中的异常处理相关语句和迭代器
    和好朋友渐行渐远是什么感觉?
    MDX学习笔记(整理) MDX语法
    Cognos软件介绍文档(原创)
    隐藏
    android::Mutex::Autolock的使用
    Android中sp和wp的使用
    Day 07 字符编码,文件操作
  • 原文地址:https://www.cnblogs.com/Flash-plus/p/13834269.html
Copyright © 2011-2022 走看看