计算两个矩形的重合面积
import math
x1, y1, x2, y2 = input().split(" ")
x1, y1, x2, y2=int(x1), int(y1), int(x2), int(y2)
# print(x1, y1, x2, y2)
x1,x2 = min(x1,x2),max(x1,x2)
y1,y2= min(y1,y2),max(y1,y2) # print(x1, y1, x2, y2) x3, y3, x4, y4 = input().split(" ")
x3, y3, x4, y4 = int(x3), int(y3), int(x4), int(y4)
x3,x4 = min(x3,x4),max(x3,x4)
y3,y4 = min(y3,y4),max(y3,y4) # print(x3, y3, x4, y4) if (x2<=x3 or x4<=x1) and (y2 <= y3 or y4<=y1):
print(0)
else:
lens = min(x2, x4) - max(x1, x3)
wide = min(y2, y4) - max(y1, y3)
print(lens*wide)

字符串重叠输出

import string

in_str = input()
nums = string.digits a = ""
strs = ""
num = ""
for i in range(len(in_str)):
if in_str[i] not in nums:
a = a+in_str[i]
else:
if i == len(in_str)-1 or (in_str[i+1] not in nums):
num = int(num + in_str[i])
strs = strs + a*num
a=""
num=""
else:
num = num + in_str[i] print(strs)

Python 实现两个矩形重合面积的更多相关文章

  1. Torch 两个矩形框重叠面积的计算 (IoU between tow bounding box)

    Torch 两个矩形框重叠面积的计算 (IoU between tow bounding box) function DecideOberlap(BBox_x1, BBox_y1, BBox_x2, ...

  2. hdu 1255 覆盖的面积(求覆盖至少两次以上的面积)

    了校赛,还有什么途径可以申请加入ACM校队?  覆盖的面积 Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  3. Lodop打印设计矩形重合预览线条变粗

    LODOP中的打印设计是辅助进行开发的,实际打印效果应以预览为准,很多效果都是在设计界面显示不出来,或设计和预览界面有差异.例如add_print_text文本的字间距.行间距,旋转,还有允许标点溢出 ...

  4. hdu2056 矩形重叠面积(水题)

    题意:       给你两个矩形,问你他们的重叠面积是多少. 思路:      这两个矩形是平行x和y轴的,所以水题,不解释. #include<stdio.h> typedef stru ...

  5. python保留两位小数

    python保留两位小数: In [1]: a = 5.026 In [2]: b = 5.000 In [3]: round(a,2) Out[3]: 5.03 In [4]: round(b,2) ...

  6. python将两个数组合并成一个数组的两种方法的代码

    内容过程中,把写内容过程中常用的内容收藏起来,下面的资料是关于python将两个数组合并成一个数组的两种方法的内容,希望能对小伙伴们有帮助. c1 = ["Red","G ...

  7. TZOJ 2392 Bounding box(正n边形三点求最小矩形覆盖面积)

    描述 The Archeologists of the Current Millenium (ACM) now and then discover ancient artifacts located ...

  8. hdu 5120 Intersection 两个圆的面积交

    Intersection Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) P ...

  9. POJ 2546 &amp; ZOJ 1597 Circular Area(求两圆相交的面积 模板)

    题目链接: POJ:http://poj.org/problem? id=2546 ZOJ:problemId=597" target="_blank">http: ...

随机推荐

  1. TensorFlow.js入门:一维向量的学习

    转载自:https://blog.csdn.net/weixin_34061042/article/details/89700664 一维向量及其运算 tensor 是 TensorFlow.js 的 ...

  2. ProceedingJoinPoint获取实现类接口上的注解

    使用aspectj处理拦截aop,需要获取实现类接口上的注解 public Object around(ProceedingJoinPoint pjp) throws Throwable{ long ...

  3. GIT : IDEA切换到某个tag

    背景看一本presto的书,发现版本用的是presto-0.107这个版本.然后我去Apache clone下源码,发现分支只有几个,但是下载页面却有很多不同的版本 然后看Tag发现有很多. 然后我现 ...

  4. 数据结构——链队列(linked queue)

    /* linkedQueue.c */ /* 链队列 */ #include <stdio.h> #include <stdlib.h> #include <stdboo ...

  5. 洛谷4965 薇尔莉特的打字机(Trie,DP)

    神仙题. 考虑在一棵 Trie 上进行染色,将可能出现的串的末尾染成黑色.答案就是黑点的个数.一开始只有 \(A\) 的末尾点是黑色. 当出现一个字符(不是退格)\(c\) 时,就要将每个黑点的 \( ...

  6. 算法&设计模式

    这里更新Python 算法&设计模式部分的博客(或目录链接)

  7. 关于ProxmoxVE

    1) PVE简介 PVE是Proxmox Virtual Environment(Proxmox虚拟化环境,也通常简称为Proxmox VE)的简称,它是基于QEMU/KVM和LXC的开源服务器虚拟化 ...

  8. [转载]3.13 UiPath存在图像Image Exists的介绍和使用

    一.Image Exists的介绍 检查是否在指定的UI元素中找到图像,输出的是一个布尔值 二.Image Exists在UiPath中的使用 1.打开设计器,在设计库中新建一个Sequence,为序 ...

  9. 【2019年08月06日】A股最便宜的股票

    查看更多A股最便宜的股票:androidinvest.com/CNValueTop/ 便宜指数 = PE + PB + 股息 + ROE,四因子等权,数值越大代表越低估. 本策略只是根据最新的数据来选 ...

  10. vue + element 文件上传 并将文件转 base64

    当时有一个需求 是需要用到上传文件这个功能,并且需要将文件转为 base64 给到后台.网上找的全是啥图片转base64 肯定是因为这类需求比较常见.当时有点懵了.后面一想,都他娘是文件啊.然后就找到 ...