首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    HDOJ 1033 Edge

    Problem Description For products that are wrapped in small packings it is necessary that the sheet of paper containing the directions for use is folded until its size becomes small enough. We assume that a sheet of paper is rectangular and only folded along lines parallel to its initially shorter edge. The act of folding along such a line, however, can be performed in two directions: either the surface on the top of the sheet is brought together, or the surface on its bottom. In both cases the two parts of the rectangle that are separated by the folding line are laid together neatly and we ignore any differences in thickness of the resulting folded sheet. After several such folding steps have been performed we may unfold the sheet again and take a look at its longer edge holding the sheet so that it appears as a one-dimensional curve, actually a concatenation of line segments. If we move along this curve in a fixed direction we can classify every place where the sheet was folded as either type A meaning a clockwise turn or type V meaning a counter-clockwise turn. Given such a sequence of classifications, produce a drawing of the longer edge of the sheet assuming 90 degree turns at equidistant places.

    01

    python图片转换pdf

    #!/home/chao/anaconda3/envs/test_py2/bin/python #coding:utf-8 import os import sys from reportlab.lib.pagesizes import A4, landscape from reportlab.pdfgen import canvas from PIL import Image from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont #需要预告安装支持中文的字体,如simfang从win拷贝过来安装 def createPdf(dstpath,fileList):     img = Image.open( fileList[0].decode('UTF-8') )     c = canvas.Canvas(dstpath, img.size)#第一张图片的尺寸新建pdf     pdfmetrics.registerFont(TTFont('simfang','simfang.ttf')) #注册字体     fontheight=15     c.setFont('simfang',fontheight)     #c.drawString(100, 300, u'宋体宋体')     height=fontheight     num=1     for i in fileList:#标明本pdf的文件列表         c.drawString(fontheight,height,str(num)+"/"+str(len(fileList)))         c.drawString(fontheight+50, height, os.path.split(i)[1])         num+=1         height+=fontheight     c.showPage()     for i in fileList:         c.drawImage(i.decode('UTF-8'), 0, 0)#转换为中文路径名称打开         c.showPage()     c.save() def transferPdf(filePath,dstpath): #将一个目录下所有图片生成一个pdf     fileList=[]     #result=os.popen(" ls -l "+filePath+"| awk \'{print $9}\' | sort -t _ -k1,1 -k2n,2 ").read()     result=os.popen(" ls  "+filePath+"|  sort -t _ -k1,1 -k2n,2 ").read()     currentIndex=0     pdfIndex=0     for i in result.split("\n"):         if i.strip()!='':             print i             fileList.append(os.path.join(filePath, i))             currentIndex+=1             if currentIndex == 100:#每几页一创建                 currentIndex=0                 pdfIndex+=1                 createPdf( os.path.join(dstpath, str(pdfIndex)+".pdf") ,fileList)                 fileList=[] filePath = "/home/chao/img"#源图片文件夹 dstpath="/home/chao/tmp1"#转换出的pdf文件夹存放地址 transferPdf(filePath,dstpath)

    01

    一个简单的页面加载管理类(包含加载中,加载失败,数据为空,加载成功)

    在最近公布的比赛框架中,发现了页面加载管理类,觉得挺有用的,所以做个简单的笔记。 什么是页面加载管理类呢?(大佬可直接跳过翻看实现过程) 如果能有这个问题,那么很好,哈哈哈,你和我一样,刚开始都挺疑惑的。 我们一般在写网络请求的时候,如果不涉及什么MVP,或者别的,就一个简单网络请求,然后再成功的结果里刷新View,请求过程中总不能白屏吧,所以有些人可能会让转一个圈,或者显示加载中的布局,然后等成功后再隐藏掉,显示具体的布局view。这样的话,也没什么问题,但是如果你的状态需要多个,这个时候就很烦了。总

    04
    领券