Problem Description
Little E is doing geometry works. After drawing a lot of points on a plane, he want to enumerate all the triangles which the vertexes are three of the points to find out the one with minimum perimeter. Your task is to implement his work.

Input
The input contains several test cases. The first line of input contains only one integer denoting the number of test cases.
The first line of each test cases contains a single integer N, denoting the number of points. (3 <= N <= 1000)
Next N lines, each line contains two integer X and Y, denoting the coordinates of a point. (0 <= X, Y <= 1000)

Output
For each test cases, output the minimum perimeter, if no triangles exist, output "No Solution".

Sample Input
2
3
0 0
1 1
2 2
4
0 0
0 2
2 1
1 1

Sample Output
Case 1: No Solution
Case 2: 4.650

Enumerate the Triangles 枚举问题
Problem Description Little E is doing geometry works. After drawing a lot of points on a plane, he want to enumerate all the triangles which the vertexes are three of the points to find out the one with minimum perimeter. Your task is to implement his work. Input The input contains several test cases. The first line of input contains only one integer denoting the number of test cases. The first line of each test cases contains a single integer N, denoting the number of points. (3 <= N <= 1000) Next N lines, each line contains two integer X and Y, denoting the coordinates of a point. (0 <= X, Y <= 1000) Output For each test cases, output the minimum perimeter, if no triangles exist, output "No Solution". Sample Input 2 3 0 0 1 1 2 2 4 0 0 0 2 2 1 1 1 Sample Output Case 1: No Solution Case 2: 4.650
python enumerate函数问题

enumerate the fonts 一闪就没了？
python3调用别人的opencv图片匹配程序报错

c# MTP 获取便携设备中的文件名称、路径等信息

tensorflow载入训练好的模型进行预测，同一张图片预测的结果却不一样？？？？

python获取邮箱的内容后,怎么取到里面的验证码
# 连接到POP3服务器: server = poplib.POP3(pop3_server) # 可以打开或关闭调试信息: # server.set_debuglevel(1) # 可选:打印POP3服务器的欢迎文字: print(server.getwelcome().decode('utf-8')) # 身份认证: server.user(email) server.pass_(password) # stat()返回邮件数量和占用空间: print('Messages: %s. Size: %s' % server.stat()) # list()返回所有邮件的编号: resp, mails, octets = server.list() # 可以查看返回的列表类似[b'1 82923', b'2 2184', ...] # print(mails) # 获取最新一封邮件, 注意索引号从1开始: index = len(mails) resp, lines, octets = server.retr(index) # lines存储了邮件的原始文本的每一行, # 可以获得整个邮件的原始文本: msg_content = b'\r\n'.join(lines).decode('utf-8') # 稍后解析出邮件: msg = Parser().parsestr(msg_content) print_info(msg) ![图片说明](https://img-ask.csdn.net/upload/201912/05/1575552952_417417.png) 全部源码如下： # -*- coding: utf-8 -*- from email.parser import Parser from email.header import decode_header from email.utils import parseaddr import poplib import requests import json import re # 输入邮件地址, 口令和POP3服务器地址: email = "123456789@qq.com" password = "abcdefg" pop3_server = "pop.qq.com" # 文本邮件的内容也是str，还需要检测编码，否则，非UTF-8编码的邮件都无法正常显示 def guess_charset(msg): charset = msg.get_charset() if charset is None: content_type = msg.get('Content-Type', '').lower() pos = content_type.find('charset=') if pos >= 0: charset = content_type[pos + 8:].strip() return charset def decode_str(s): # decode_header()返回一个list 偷懒，只取了第一个元素 value, charset = decode_header(s)[0] if charset: value = value.decode(charset) return value def print_info(msg, indent=0): if indent == 0: for header in ['From', 'To', 'Subject']: value = msg.get(header, '') if value: if header=='Subject': value = decode_str(value) else: hdr, addr = parseaddr(value) name = decode_str(hdr) value = u'%s <%s>' % (name, addr) print('%s%s: %s' % (' ' * indent, header, value)) if (msg.is_multipart()): parts = msg.get_payload() for n, part in enumerate(parts): print('%spart %s' % (' ' * indent, n)) print('%s--------------------' % (' ' * indent)) print_info(part, indent + 1) else: content_type = msg.get_content_type() if content_type=='text/plain' or content_type=='text/html': content = msg.get_payload(decode=True) charset = guess_charset(msg) if charset: content = content.decode(charset) print('%sText: %s' % (' ' * indent, content + '...')) else: print('%sAttachment: %s' % (' ' * indent, content_type)) # 连接到POP3服务器: server = poplib.POP3(pop3_server) # 可以打开或关闭调试信息: # server.set_debuglevel(1) # 可选:打印POP3服务器的欢迎文字: print(server.getwelcome().decode('utf-8')) # 身份认证: server.user(email) server.pass_(password) # stat()返回邮件数量和占用空间: print('Messages: %s. Size: %s' % server.stat()) # list()返回所有邮件的编号: resp, mails, octets = server.list() # 可以查看返回的列表类似[b'1 82923', b'2 2184', ...] # print(mails) # 获取最新一封邮件, 注意索引号从1开始: index = len(mails) resp, lines, octets = server.retr(index) # lines存储了邮件的原始文本的每一行, # 可以获得整个邮件的原始文本: msg_content = b'\r\n'.join(lines).decode('utf-8')\ # 稍后解析出邮件: msg = Parser().parsestr(msg_content) print_info(msg)

Linux+pytorch下运行报错RuntimeError: PyTorch was compiled without NumPy support

scrapy爬取过程中出现重复的
# -*- coding: utf-8 -*- import scrapy class JobSpider(scrapy.Spider): name = 'job' allowed_domains = ['guazi.com'] start_urls = ['https://www.guazi.com/hz/buy/'] def parse(self, response): car_list=response.xpath('/html/body/div[6]/ul/li/a') # print(car_list) for num,i in enumerate(car_list): item={} item['name']=i.xpath('/html/body/div[6]/ul/li/a/h2/text()').extract()[num] #可以提取不同的 print(item) item['link']=i.xpath('/html/body/div[6]/ul[1]/li/a/@href').extract_first()提取的全是重复的
tensorflow.python.framework.errors_impl.InternalError: Blas GEMM launch failed ，程序中出现anaconda错误？

Description A Black Box algorithm supposes that natural number sequence u(1), u(2), ..., u(N) is sorted in non-descending order, N <= M and for each p (1 <= p <= N) an inequality p <= u(p) <= M is valid. Making tests for this algorithm we have met with the following problem. For setting a random sequence {u(i)} a usual random data generator did not fit. As the sequence itself had been imposed certain restrictions, the method of choosing the next random element (in the interval defined by restrictions) did not give the random sequence as a whole. We have come to a conclusion that the problem can be solved in the following way. If we arrange all possible sequences in certain order (for example, in lexicographical order) and assign each sequence its number, after choice of the random number it is possible to take the correspondent sequence for the random one. At the first glance it seems enough to make up a program generating all these sequences in such order. Alas! Even having not great values of M and N it would have taken any powerful modern computer centuries to enumerate all such sequences. It turned out it was possible to avoid generating all sequences if we managed to create required sequence according to its number immediately. But even this statement does not cover all. As the amount of sequences is quite large, the number can be a long one, composed of hundreds decimal digits, though our random data generator could give only normal numbers. We decided to produce a long random number from a real random number distributed in [0,1]. Namely, present the number in binary notation: 0.b(1)b(2)..., where all b(i) = 0 or 1. Let us set a regulation to associate such real number to an integer from [A,B] segment: Formula 1: Here we suppose, that A <= B, p >= 0, and ``div 2" is an integer division by 2. Let M, N (1 <= N <= M <= 200) and a binary real number 0.b(1)b(2)...b(p) (1 <= p <= 400) be given. Write a program to find out the corresponding u(1), u(2), ..., u(N) sequence, i.e. to find a sequence with G(1,T,0.b(1)b(2)...b(p)) number in lexicographical order of all possible {u(i)} for the given M and N (T is the quantity of such sequences). Numeration begins with 1. Keep in mind that in lexicographical order {l(i)} proceeds {h(i)} if after omitting equal beginnings, the first number of {l(i)} tail is smaller than the first number or {h(i)} tail. Following example illustrates the list of all possible sequences for M = 4 and N = 3 in lexicographical order. A note (it does not concern the solution of this task): The choice of random binary vector 0.b(1)b(2)...b(p) does not give an absolute uniform random data generator if we use the Formula. However, taking into account the fact that [A,B] interval is big we shall obtain a distribution applicable in most cases. Example 1, 2, 3 1, 2, 4 1, 3, 3 1, 3, 4 1, 4, 4 2, 2, 3 2, 2, 4 2, 3, 3 2, 3, 4 2, 4, 4 3, 3, 3 3, 3, 4 3, 4, 4 4, 4, 4 (here T=14) Input The first line of input contains M and N. The second line contains binary real number 0.b(1)b(2)...b(p) (without leading, trailing and other spaces). Output Write into the output the corresponding sequence u(1), u(2), ..., u(N). The sequence numbers should be separated with one space. Sample Input 4 3 0.01101101011110010001101010001011010 Sample Output 2 2 4
pytorch 中 写入class ConvNet(nn.Module): 语句之后 出现错误NameError: name 'ConvNet' is not defined 这是怎么回事？
```import torch import torch.nn as nn from torch.autograd import Variable import torch.optim as optim import torch.nn.functional as F import torchvision.datasets as dsets import torchvision.transforms as transforms import matplotlib.pyplot as plt import numpy as np #%matplotlib inline image_size=28 num_classes=10 num_epochs=20 batch_size=64 train_dataset=dsets.MNIST(root='./data', train=True, transform=transforms.ToTensor(), download=True) test_dataset=dsets.MNIST(root='./data', train=False, transform=transforms.ToTensor()) train_loader=torch.utils.data.DataLoader(dataset=train_dataset, batch_size=batch_size, shuffle=True) indices=range(len(test_dataset)) indices_val=indices[:5000] indices_test=indices[5000:] sampler_val=torch.utils.data.sampler.SubsetRandomSampler(indices_val) sampler_test=torch.utils.data.sampler.SubsetRandomSampler(indices_test) validation_loader=torch.utils.data.DataLoader(dataset=test_dataset, batch_size=batch_size, shuffle=False, sampler=sampler_val ) test_loader=torch.utils.data.DataLoader(dataset=test_dataset, batch_size=batch_size, shuffle=False, sampler=sampler_test ) idx=110 #随机选取的 muteimg=train_dataset[idx][0].numpy() plt.imshow(muteimg[0,...]) plt.show() print('标签是:',train_dataset[idx][1]) depth=[4,8] class ConvNet(nn.Module): def __init__(self): super(ConvNet,self).__init__() self.conv1=nn.Conv2d(1,4,5,padding=2) self.pool=nn.MaxPool2d(2,2) self.conv2=nn.Conv2d(depth[0],depth[1],5,padding=2) self.fc1=nn.Linear(image_size//4*image_size//4*depth[1],512) self.fc2=nn.Linear(512,num_classes) def forward(self, x): x=self.conv1(x) x=F.relu(x) x=self.pool(x) x=self.conv2(x) x=F.relu(x) x=self.pool(x) x=x.view(-1,image_size//4*image_size//4*depth[1]) x=F.relu(self.fc1(x)) x=F.dropout(x,training=self.training) x=self.fc2(x) x=F.log_softmax(x,dim=1) return x def retrieve_features(self,x): feature_map1=F.relu(self.conv1(x)) x=self.pool(feature_map1) feature_map2=F.relu(self.conv2(x)) return (feature_map1,feature_map2) net=ConvNet() criterion=nn.CrossEntropyLoss() optimizer=optim.SGD(net.parameters(),lr=0.001,momentum=0.9) record=[] weights=[] for epoch in range(num_epochs): train_rights=[] for batch_idx,(data,target) in enumerate (train_loader): data,target=Variable(data),Variable(target) net.train() output=net(data) loss=criterion(output,target) optimizer.zero_grad() optimizer.step() right=rightness(output,target) train_rights.append(right) if batch_idx % 100 ==0: net.eval() val_rights=[] for(data,target) in validation_loader: data,target=Variable(data),Variable(target) output=net(data) right=rightness(output,target) val_rights.append(right) train_r=(sum([tup[o] for tup in train_rights]),sum([tup[1] for tup in train_rights])) val_r=(sum([tup[0] for tup in val_rights]),sum([tup[1] for tup in val_rights])) record.append((100 - 100.*train_r[0]/train_r[1],100-100.*val_r[0]/val_r[1])) weights.append([net.conv1.weight.data.clone(),net.conv1.bias.data.clone(), net.conv2.weight.data.clone(),net.conv2.bias.data.clone()]) net.eval() vals=[] for dara,target in test_loader: data,targrt=Variable(data,volatile=True),Variable(target) output = net(data) val=rightness(output,target) vals.append(val) rights=(sum([tup[0] for tup in vals]),sum([tup[1] for tup in vals])) rights_rate=1.0*rights[0]/rights[1] right_rate plt.figure(figsize=(10,7)) plt.plot(record) plt.xlabel('Steps') plt.ylabel('Error rate') ``` ```pytorch 中 写入class ConvNet(nn.Module): 语句之后 出现错误NameError: name 'ConvNet' is not defined 这是怎么回事
Friends or Enemies?

Java学习的正确打开方式

Python——画一棵漂亮的樱花树（不同种樱花+玫瑰+圣诞树喔）

HashMap 相关概念 HashTab、HashMap、TreeMap 均以键值对像是存储或操作数据元素。HashTab继承自Dictionary，HashMap、TreeMap继承自AbstractMap，三者均实现Map接口 **HashTab：**同步哈希表，不支持null键或值，因为同步导致性能影响，很少被使用 **HashMap：**应用较多的非同步哈希表，支持null键或值，是键值对...

linux系列之常用运维命令整理笔录

Python 基础（一）：入门必备知识

Python十大装B语法
Python 是一种代表简单思想的语言，其语法相对简单，很容易上手。不过，如果就此小视 Python 语法的精妙和深邃，那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点，并附上详细的实例代码。如能在实战中融会贯通、灵活使用，必将使代码更为精炼、高效，同时也会极大提升代码B格，使之看上去更老练，读起来更优雅。 1. for - else 什么？不是 if 和 else 才

2019年11月中国大陆编程语言排行榜
2019年11月2日，我统计了某招聘网站，获得有效程序员招聘数据9万条。针对招聘信息，提取编程语言关键字，并统计如下： 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7

JDK12 Collectors.teeing 你真的需要了解一下

“狗屁不通文章生成器”登顶GitHub热榜，分分钟写出万字形式主义大作

《程序人生》系列-这个程序员只用了20行代码就拿了冠军

11月8日，由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办，科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。 　　区块链技术被认为是继蒸汽机、电力、互联网之后，下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力，电力解决了人类基本的生活需求，互联网彻底改变了信息传递的方式，区块链作为构造信任的技术有重要的价值。 　　1...

8年经验面试官详解 Java 面试秘诀