OpenGL uniform block有index 而没有location

Teleport Out! 怎么解答的
Problem Description You are in a rectangular maze and you would like to leave the maze as quickly as possible. The maze is a rectangular grid of square locations. Some locations are blocked. Some other locations are exits. If you arrive at an exit location, you can immediately leave the maze. You may walk one step at a time, onto one of the locations adjacent to your current location. Two locations are adjacent if they share a side. That is, you can only move one step North, South, East or West. Of course, you cannot step off the maze, and you cannot step onto a blocked location. In addition, at any step, you may choose to use your teleport device. This device will send you to a random non-blocked location inside the maze with uniform probability (including, possibly, the one where you currently are standing!). If the device happens to send you onto a spot that is also an exit, then you leave the maze immediately. Hooray! The only way to leave the maze is by moving onto an exit (either by teleport or walking), you may not walk off the boundary of the maze. Write a program to calculate the expected number of steps you need in order to leave the maze. Assume that you would choose your actions (movements and using teleport device) optimally in order to minimize the expected number of steps to leave the maze. Using the teleport device is considered one step. Input There will be multiple test cases. Each test case starts with a line containing two positive integers R and C ( R<=200, C<=200 ). Then, the next R lines each contain C characters, representing the locations of the maze. The characters will be one of the following: E : represents an exit, there will be at least one E' in every maze. Y : represents your initial location, there will be exactly one Y' in every maze. X : represents a blocked location. . : represents an empty space. You may move/teleport onto any location that is marked E', Y' or .'. The end of input is marked by a line with two space-separated 0's. Output For each test case, print one line containing the minimum expected number of steps required to leave the maze, given that you make your choices optimally to minimize this value. Print your result to 3 decimal places. Do not print any blank lines between outputs. Sample Input 2 1 E Y 2 2 E. .Y 3 3 EX. XX. ..Y 3 3 EXY .X. ... 0 0 Sample Output 1.000 2.000 6.000 3.250
Uniform Generator 计算设计
Problem Description Computer simulations often require random numbers. One way to generate pseudo-random numbers is via a function of the form seed(x+1) = [seed(x) + STEP] % MOD where '%' is the modulus operator. Such a function will generate pseudo-random numbers (seed) between 0 and MOD-1. One problem with functions of this form is that they will always generate the same pattern over and over. In order to minimize this effect, selecting the STEP and MOD values carefully can result in a uniform distribution of all values between (and including) 0 and MOD-1. For example, if STEP = 3 and MOD = 5, the function will generate the series of pseudo-random numbers 0, 3, 1, 4, 2 in a repeating cycle. In this example, all of the numbers between and including 0 and MOD-1 will be generated every MOD iterations of the function. Note that by the nature of the function to generate the same seed(x+1) every time seed(x) occurs means that if a function will generate all the numbers between 0 and MOD-1, it will generate pseudo-random numbers uniformly with every MOD iterations. If STEP = 15 and MOD = 20, the function generates the series 0, 15, 10, 5 (or any other repeating series if the initial seed is other than 0). This is a poor selection of STEP and MOD because no initial seed will generate all of the numbers from 0 and MOD-1. Your program will determine if choices of STEP and MOD will generate a uniform distribution of pseudo-random numbers. Input Each line of input will contain a pair of integers for STEP and MOD in that order (1 <= STEP, MOD <= 100000). Output For each line of input, your program should print the STEP value right- justified in columns 1 through 10, the MOD value right-justified in columns 11 through 20 and either "Good Choice" or "Bad Choice" left-justified starting in column 25. The "Good Choice" message should be printed when the selection of STEP and MOD will generate all the numbers between and including 0 and MOD-1 when MOD numbers are generated. Otherwise, your program should print the message "Bad Choice". After each output test set, your program should print exactly one blank line. Sample Input 3 5 15 20 63923 99999 Sample Output 3 5 Good Choice 15 20 Bad Choice 63923 99999 Good Choice
python类中call和__call__的区别？

The Seven Percent Solution 的解决
Problem Description Uniform Resource Identifiers (or URIs) are strings like http://icpc.baylor.edu/icpc/, mailto:foo@bar.org, ftp://127.0.0.1/pub/linux, or even just readme.txt that are used to identify a resource, usually on the Internet or a local computer. Certain characters are reserved within URIs, and if a reserved character is part of an identifier then it must be percent-encoded by replacing it with a percent sign followed by two hexadecimal digits representing the ASCII code of the character. A table of seven reserved characters and their encodings is shown below. Your job is to write a program that can percent-encode a string of characters. Character Encoding " " (space) %20 "!" (exclamation point) %21 "" (dollar sign) %24 "%" (percent sign) %25 "(" (left parenthesis) %28 ")" (right parenthesis) %29 "*" (asterisk) %2a Input The input consists of one or more strings, each 1–79 characters long and on a line by itself, followed by a line containing only "#" that signals the end of the input. The character "#" is used only as an end-of-input marker and will not appear anywhere else in the input. A string may contain spaces, but not at the beginning or end of the string, and there will never be two or more consecutive spaces. Output For each input string, replace every occurrence of a reserved character in the table above by its percent-encoding, exactly as shown, and output the resulting string on a line by itself. Note that the percent-encoding for an asterisk is %2a (with a lowercase "a") rather than %2A (with an uppercase "A"). Sample Input Happy Joy Joy! http://icpc.baylor.edu/icpc/ plain_vanilla (**) ? the 7% solution # Sample Output Happy%20Joy%20Joy%21 http://icpc.baylor.edu/icpc/ plain_vanilla %28%2a%2a%29 ? the%207%25%20solution Aligning Two Shapes 对齐的问题 Problem Description The knowledge about Shape from Wikipedia: Simple two-dimensional shapes can be described by basic geometry such as points, line, curves, plane, and so on. (A shape whose points belong all the same plane is called a plane figure.) Most shapes occurring in the physical world are complex. Some, such as plant structures and coastlines, may be so arbitrary as to defy traditional mathematical description – in which case they may be analyzed by differential geometry, or as fractals. Rigid shape definition In geometry, two subsets of a Euclidean space have the same shape if one can be transformed to the other by a combination of translations, rotations (together also called rigid transformations), and uniform scalings. In other words, the shape of a set is all the geometrical information that is invariant to position (including rotation) and scale. Having the same shape is an equivalence relation, and accordingly a precise mathematical definition of the notion of shape can be given as being an equivalence class of subsets of a Euclidean space having the same shape. From the message above, we know that we can use the operations of translations, rotations and scaling to align two shapes. Now we assume that the shapes we describe in the problem is form with a set of points. For example, a shape S = {x1, y1, x2, y2.... xn, yn}. In the picture below, we use four points to represent a square. The two squares are all centred on the origin (0, 0). After the operation of scaling, S1 is coincides with S2. To simplify the problem, we suppose two shapes, X1 and X2, centred on the origin (0, 0) initially. That means you can only use the operations of rotations and scaling, but not the translations. We wish to scale and rotate S1 by (s, θ) so as to minimize the sum of the square distances between the points of S1 and S2. Rotation means a two-dimensional object rotates around a center (or point).Scaling means a linear transformation that enlarges or diminishes objects. Input Each test case contains a single integer t (t<=1000), indicating the size of the two shapes (i.e., each shape has t points). The next following t lines each contain two integers (xi, yi) representing the shape of S1, then following t lines stands for the shape of S2. The input is terminated by a set starting with t = 0. Output For each test case, you should output one line containing a real number representing the minimum distance of the two shapes after the operations of rotation and scaling. The number should be rounded to three fractional digits. Sample Input 4 1 1 1 -1 -1 1 -1 -1 2 2 2 -2 -2 2 -2 -2 0 Sample Output 0.000 Parsing URL 解析地址问题 Problem Description In computing, a Uniform Resource Locator or Universal Resource Locator (URL) is a character string that specifies where a known resource is available on the Internet and the mechanism for retrieving it. The syntax of a typical URL is: scheme://domain:port/path?query_string#fragment_id In this problem, the scheme, domain is required by all URL and other components are optional. That is, for example, the following are all correct urls: http://dict.bing.com.cn/#%E5%B0%8F%E6%95%B0%E7%82%B9 http://www.mariowiki.com/Mushroom https://mail.google.com/mail/?shva=1#inbox http://en.wikipedia.org/wiki/Bowser_(character) ftp://fs.fudan.edu.cn/ telnet://bbs.fudan.edu.cn/ http://mail.bashu.cn:8080/BsOnline/ Your task is to find the domain for all given URLs. Input There are multiple test cases in this problem. The first line of input contains a single integer denoting the number of test cases. For each of test case, there is only one line contains a valid URL. Output For each test case, you should output the domain of the given URL. Sample Input 3 http://dict.bing.com.cn/#%E5%B0%8F%E6%95%B0%E7%82%B9 http://www.mariowiki.com/Mushroom https://mail.google.com/mail/?shva=1#inbox Sample Output Case #1: dict.bing.com.cn Case #2: www.mariowiki.com Case #3: mail.google.com 为什么我的热力图只显示一半 seaborn matplot matplotlab 为什么我的热力图上下两行只显示一半？  import matplotlib.pyplot as plt import seaborn as sns import numpy as np a = np.random.uniform(0, 1, size=(10, 10)) sns.heatmap(a, cmap='Reds') plt.show()  ![上下两行方块只有一半](https://img-ask.csdn.net/upload/201912/12/1576141826_261656.png) The Seven Percent Solution Problem Description Uniform Resource Identifiers (or URIs) are strings like http://icpc.baylor.edu/icpc/, mailto:foo@bar.org, ftp://127.0.0.1/pub/linux, or even just readme.txt that are used to identify a resource, usually on the Internet or a local computer. Certain characters are reserved within URIs, and if a reserved character is part of an identifier then it must be percent-encoded by replacing it with a percent sign followed by two hexadecimal digits representing the ASCII code of the character. A table of seven reserved characters and their encodings is shown below. Your job is to write a program that can percent-encode a string of characters. Character Encoding " " (space) %20 "!" (exclamation point) %21 "" (dollar sign) %24 "%" (percent sign) %25 "(" (left parenthesis) %28 ")" (right parenthesis) %29 "*" (asterisk) %2a Input The input consists of one or more strings, each 1–79 characters long and on a line by itself, followed by a line containing only "#" that signals the end of the input. The character "#" is used only as an end-of-input marker and will not appear anywhere else in the input. A string may contain spaces, but not at the beginning or end of the string, and there will never be two or more consecutive spaces. Output For each input string, replace every occurrence of a reserved character in the table above by its percent-encoding, exactly as shown, and output the resulting string on a line by itself. Note that the percent-encoding for an asterisk is %2a (with a lowercase "a") rather than %2A (with an uppercase "A"). Sample Input Happy Joy Joy! http://icpc.baylor.edu/icpc/ plain_vanilla (**) ? the 7% solution # Sample Output Happy%20Joy%20Joy%21 http://icpc.baylor.edu/icpc/ plain_vanilla %28%2a%2a%29 ? the%207%25%20solution
tensorflow训练完模型直接测试和导入模型进行测试的结果不同，一个很好，一个略差，这是为什么？

python使用scapy，使用发包工具时，报错NameError: name 'udp' is not defined，求解答，
 #!env python # -*- coding: <encoding name> -*- import sys from scapy.all import * import os,random,datetime,time,math from random import randrange from random import uniform from functools import reduce def create_data(line): current_time = [ datetime.datetime.now().strftime('%b %d %H:%M:%S'), datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), # datetime.datetime.now().strftime('%b %d %H:%M:%S %Y'), str(math.trunc(datetime.datetime.now().timestamp())) ] regular = [ "(\w{3}\s+\d{1,2}\s+\d{1,2}:\d{1,2}:\d{1,2})", "(\d{4}-\d{1,2}-\d{1,2}\s+\d{1,2}:\d{1,2}:\d{1,2})", "(\w{3}\s+\d{1,2}\s+\d{1,2}:\d{1,2}:\d{1,2}\s+\d{1,4})", "(\d{10})" ] def current_time(line): for i in regular: for j in current_time(line): if len(re.findall(i, j)) != 0: #若正则匹配上相对应的时间格式，则对字符串进行替换 line=re.sub(i,j,line) return line dict_ip_logfile={ "192.168.58.84": r"C:\Users\CS\Desktop\HPHIDS.txt" } while True: for ip,logfile in dict_ip_logfile.items(): with open(logfile,"r",encoding='unicode_escape') as log: for line in log: print(ip) print(logfile) print(create_data(line)) # IP = (porto='udp','192.168.57.45') # UDP = (dst='192.168.57.14',8089) # scapy.all,send(IP,udp) scapy.all.send(IP(proto="udp",src=ip,dst="192.168.57.45")/udp(dst='192.168.57.14.',dport=8082)/line,inter=5,loop=1,count=2) log.close()  ![图片说明](https://img-ask.csdn.net/upload/201911/21/1574303068_105938.png)

Aligning Two Shapes 实现的原理
Problem Description The knowledge about Shape from Wikipedia: Simple two-dimensional shapes can be described by basic geometry such as points, line, curves, plane, and so on. (A shape whose points belong all the same plane is called a plane figure.) Most shapes occurring in the physical world are complex. Some, such as plant structures and coastlines, may be so arbitrary as to defy traditional mathematical description – in which case they may be analyzed by differential geometry, or as fractals. Rigid shape definition In geometry, two subsets of a Euclidean space have the same shape if one can be transformed to the other by a combination of translations, rotations (together also called rigid transformations), and uniform scalings. In other words, the shape of a set is all the geometrical information that is invariant to position (including rotation) and scale. Having the same shape is an equivalence relation, and accordingly a precise mathematical definition of the notion of shape can be given as being an equivalence class of subsets of a Euclidean space having the same shape. From the message above, we know that we can use the operations of translations, rotations and scaling to align two shapes. Now we assume that the shapes we describe in the problem is form with a set of points. For example, a shape S = {x1, y1, x2, y2.... xn, yn}. In the picture below, we use four points to represent a square. The two squares are all centred on the origin (0, 0). After the operation of scaling, S1 is coincides with S2. To simplify the problem, we suppose two shapes, X1 and X2, centred on the origin (0, 0) initially. That means you can only use the operations of rotations and scaling, but not the translations. We wish to scale and rotate S1 by (s, θ) so as to minimize the sum of the square distances between the points of S1 and S2. Rotation means a two-dimensional object rotates around a center (or point).Scaling means a linear transformation that enlarges or diminishes objects. Input Each test case contains a single integer t (t<=1000), indicating the size of the two shapes (i.e., each shape has t points). The next following t lines each contain two integers (xi, yi) representing the shape of S1, then following t lines stands for the shape of S2. The input is terminated by a set starting with t = 0. Output For each test case, you should output one line containing a real number representing the minimum distance of the two shapes after the operations of rotation and scaling. The number should be rounded to three fractional digits. Sample Input 4 1 1 1 -1 -1 1 -1 -1 2 2 2 -2 -2 2 -2 -2 0 Sample Output 0.000
yolo3 darknet.py问题

Problem Description Computer simulations often require random numbers. One way to generate pseudo-random numbers is via a function of the form seed(x+1) = [seed(x) + STEP] % MOD where '%' is the modulus operator. Such a function will generate pseudo-random numbers (seed) between 0 and MOD-1. One problem with functions of this form is that they will always generate the same pattern over and over. In order to minimize this effect, selecting the STEP and MOD values carefully can result in a uniform distribution of all values between (and including) 0 and MOD-1. For example, if STEP = 3 and MOD = 5, the function will generate the series of pseudo-random numbers 0, 3, 1, 4, 2 in a repeating cycle. In this example, all of the numbers between and including 0 and MOD-1 will be generated every MOD iterations of the function. Note that by the nature of the function to generate the same seed(x+1) every time seed(x) occurs means that if a function will generate all the numbers between 0 and MOD-1, it will generate pseudo-random numbers uniformly with every MOD iterations. If STEP = 15 and MOD = 20, the function generates the series 0, 15, 10, 5 (or any other repeating series if the initial seed is other than 0). This is a poor selection of STEP and MOD because no initial seed will generate all of the numbers from 0 and MOD-1. Your program will determine if choices of STEP and MOD will generate a uniform distribution of pseudo-random numbers. Input Each line of input will contain a pair of integers for STEP and MOD in that order (1 <= STEP, MOD <= 100000). Output For each line of input, your program should print the STEP value right- justified in columns 1 through 10, the MOD value right-justified in columns 11 through 20 and either "Good Choice" or "Bad Choice" left-justified starting in column 25. The "Good Choice" message should be printed when the selection of STEP and MOD will generate all the numbers between and including 0 and MOD-1 when MOD numbers are generated. Otherwise, your program should print the message "Bad Choice". After each output test set, your program should print exactly one blank line. Sample Input 3 5 15 20 63923 99999 Sample Output 3 5 Good Choice 15 20 Bad Choice 63923 99999 Good Choice
openGL实现多光源光照效果

OpenGL如何正确混合材质颜色？

Tensorflow中进行图像随机resize为什么会失败

Java学习的正确打开方式

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

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

SQL-小白最佳入门sql查询一

【图解经典算法题】如何用一行代码解决约瑟夫环问题

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

IT界知名的程序员曾说：对于那些月薪三万以下，自称IT工程师的码农们，其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居，但只是他们一厢情愿罢了。 此话一出，不知激起了多少(码农)程序员的愤怒，却又无可奈何，于是码农问程序员。 码农：你知道get和post请求到底有什么区别？ 程序员：你看这篇就知道了。 码农：你月薪三万了？ 程序员：嗯。 码农：你是怎么做到的? 程序员：
《程序人生》系列-这个程序员只用了20行代码就拿了冠军

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

【技巧总结】位运算装逼指南

8年经验面试官详解 Java 面试秘诀
作者 | 胡书敏 责编 | 刘静 出品 | CSDN（ID：CSDNnews） 本人目前在一家知名外企担任架构师，而且最近八年来，在多家外企和互联网公司担任Java技术面试官，前后累计面试了有两三百位候选人。在本文里，就将结合本人的面试经验，针对Java初学者、Java初级开发和Java开发，给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实

1.两种思维方式在求职面试中，经常会考察这种问题：北京有多少量特斯拉汽车？ 某胡同口的煎饼摊一年能卖出多少个煎饼？ 深圳有多少个产品经理？ 一辆公交车里能装下多少个乒乓球？ 一
so easy！ 10行代码写个"狗屁不通"文章生成器