![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
homework
Gosick_Geass_Gate
这个作者很懒,什么都没留下…
展开
-
浏览Python官网的发现与收获
Python官网https://www.python.org/首页有具体七个选项:(1)About,包括Applications、Quotes、GettingStarted、Help以及Python Brochure,主要是对Python的介绍;(2)Downloads,包括Allreleases、Source code、Windows、Mac OSX、Other Platforms、Licens...原创 2018-03-09 20:54:52 · 196 阅读 · 0 评论 -
Codeforces #520B Two buttons
【问题描述】Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multipl...原创 2018-05-26 15:27:40 · 345 阅读 · 0 评论 -
Introduction to Python Exercises 9.Numpy
【前置条件】按照题意,不妨将矩阵A初始化为元素服从标准高斯分布(标准正态分布)的n*m矩阵,将矩阵B初始化为首行为[0, 1, 2, ..., 499]的m*m托普利兹矩阵。import numpy as npfrom scipy.linalg import toeplitz n = 200m = 500A = np.random.randn(n, m) # 元素服从n*m标准高斯...原创 2018-05-22 13:26:26 · 174 阅读 · 0 评论 -
Codeforces #3A Shortest path of the king
【问题描述】The king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to squa...原创 2018-05-26 18:23:49 · 236 阅读 · 0 评论 -
Codeforces #985C Liebig's Barrels
【问题描述】You have m = n·k wooden staves. The i-th stave has length ai. You have to assemble n barrels consisting of k staves each, you can use any k staves to construct a barrel. Each stavemust belong ...原创 2018-05-28 20:44:37 · 312 阅读 · 0 评论 -
Codeforces #916C Jamie and Interesting Graph
【问题描述】【解决思路】这道题的答案多种多样,不妨选择最简单的情况:假使从1到n的最短路径等于最小生成树的长度,皆为不小于n–1(n-1条变)的最小素数prime,这时最短路径(最小生成树)即为一条链。再假使这条链路的前n-2段的长度皆为1,最后1段的长度即为prime-(n-2)。至于其余的边则可以赋予一个较大值(确保不影响最小生成树)。 【代码实现】#include <iostream...原创 2018-05-29 00:28:51 · 374 阅读 · 0 评论 -
Introduction to Python Exercises 11.Matplotlib
【问题解决】import numpy as npimport matplotlib.pyplot as plt # import mathx = np.linspace(0, 2, 30) # 创建X轴的数值,在0和2之间产生30个均匀分布的值 # y = [math.pow(math.sin(xi - 2), 2) * math.exp(-math.pow(xi, 2)) for ...原创 2018-05-29 15:33:16 · 180 阅读 · 0 评论 -
cme193-ipython-notebooks-lecture Exercises.ipynb
【问题描述】原创 2018-06-12 14:50:00 · 301 阅读 · 0 评论 -
Introduction to Python Exercises 10.Scipy
【问题解决】求解最小二乘法的可调用函数至少有三个:一个是np.linalg模块的lstsq函数(上周的Matplotlib的习题用到);二是scipy.optimize模块的leastsq函数;三是scipy.optimize的nnls函数。...原创 2018-06-06 00:58:46 · 263 阅读 · 0 评论 -
Scikit-Learn: Machine Learning in Python
【问题描述】【解决思路】第一步:先建立一个样本容量为2000,数据集原创 2018-06-19 14:00:36 · 463 阅读 · 0 评论 -
Codeforces #550B Preparing Olympiad
【问题描述】You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for a contest, using some of the problems you've made.A problemset for ...原创 2018-07-02 17:20:49 · 313 阅读 · 1 评论 -
参照完整性约束的特例:一个关系的属性参照另外两个关系的同名属性
《数据库系统概论》有如下题目: 显然按照题目的意思并不能直接将关系salaried_worker的属性name和关系hourly_worker的属性name都定义为关系address的外键(foreign key)。因为我们只希望要求每个出现在address中的名字必须出现在salaried_worker或hourly_worker,而不是salaried_worker和hou...原创 2018-10-20 16:17:11 · 3668 阅读 · 3 评论 -
Wilson定理推论
Wilson定理: 设 ppp 是一个素数,则(p−1)!≡−1(mod&amp;amp;amp;amp;amp;ThickSpace;p).(p-1)!\equiv-1(mod\;p).(p−1)!≡−1(modp). 此定理的证明一般不难找到,此处不作赘述。下面介绍一下相关的推论以及证明(选自《信息安全数学基础(第二版)第2章习题》)&amp;amp;amp;amp;nbsp;推论1: 如果 ppp 是奇素数,那么12⋅32⋅&a原创 2018-10-23 01:44:47 · 1674 阅读 · 0 评论 -
同余方程组有解的充要条件
命题: 同余方程组 {x≡a1(mod&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;ThickSpace;m1)x≡a2(mod&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;ThickSpace;m2)\begin{cases}x\equiv a_1(mod\;m_1)\\x\equiv a_2(mod\;m_2)原创 2018-11-20 22:02:29 · 7263 阅读 · 0 评论 -
二次同余和高次同余的几个命题
命题一:设ppp是奇素数,p∤ap\nmid ap∤a。存在正整数u,v,(u,v)=1u,v,(u,v)=1u,v,(u,v)=1,使得u2+v2≡0(mod&amp;amp;amp;amp;amp;amp;ThickSpace;p)u^2+v^2\equiv 0(mod\;p)u2+v2≡0(modp)的充要条件是−a-a−a是模ppp的二次剩余。(选自《信息安全数学基础(第二版)第4章习题》)证明:(1)充分性:因为−a是模...原创 2018-11-27 14:55:23 · 877 阅读 · 0 评论 -
LeetCode #23 Merge K Sorted Lists
【问题描述】Merge k sorted linked lists and return it as one sortedlist. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4, 2->6]Output: 1->1->2->3->4->4->...原创 2018-05-09 21:53:48 · 116 阅读 · 0 评论 -
LeetCode #215 Kth Largest Element in an Array
【问题描述】Find the kthlargest element in an unsorted array. Note that it is the kth largest elementin the sorted order, not the kth distinct element. For example, given[3,2,1,5,6,4] and k = 2, return 5.No...原创 2018-05-09 21:39:54 · 102 阅读 · 0 评论 -
LeetCode #148 Sort List
【问题描述】Sort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->0Output: -1->0-&...原创 2018-05-09 21:15:26 · 115 阅读 · 0 评论 -
Python学习小目标
(1)能够开发一个简单的小游戏;(2)能够绘制三维图形以及动画。原创 2018-03-09 21:00:39 · 394 阅读 · 0 评论 -
《Python编程 从入门到实践》第二章课后习题
2-1message = "Code Geass"print(message)2-2message = "Code Geass"print(message)message = "Psycho-Pass"print(message)2-3name = "Victorique"print("Hello, " + name + "!")2-4name = "Victoriqu原创 2018-03-10 20:41:38 · 278 阅读 · 0 评论 -
《Python编程 从入门到实践》第三章课后习题
3-1names = ['Victorique', 'Lelouch', 'Dantalian']for name in names: print(name)3-2names = ['Victorique', 'Lelouch', 'Dantalian']for name in names: print(name + ", how are you? ")3-3vehicles...原创 2018-03-15 23:53:43 · 462 阅读 · 0 评论 -
《Python编程 从入门到实践》第四章课后习题
4-1pizzas = ['pepperoni pizza', 'durian pizza', 'bacon pizza']for pizza in pizzas: print(pizza)for pizza in pizzas: print("I like " + pizza)print("I really love pizza! ")4-2animals = ['dog...原创 2018-03-19 23:57:46 · 598 阅读 · 0 评论 -
《Python编程 从入门到实践》第五章课后习题
5-2str1 = "A"str2 = "a"print(str1 == str2)print(str1.lower() == str2)# change "char" to intnum1 = ord(str1)num2 = ord(str2)print(num1 == num2)print(num1 != num2)print(num1 > num2)print(n...原创 2018-03-20 10:41:47 · 714 阅读 · 2 评论 -
《Python编程 从入门到实践》第六章课后习题
6-1friend = { 'first_name': 'Tsunemori', 'last_name': 'Akane', 'age': 20, 'city': 'Tokyo', }for key in friend.keys(): print(friend[key])6-2favorite_num = { 'Victorique': ...原创 2018-03-22 18:25:00 · 383 阅读 · 0 评论 -
《Python编程 从入门到实践》第七章课后习题
7-1car = input("What kind of car would you like to lease? \n")print("Let me see if I can find you a " + car)7-2user_num = input("How many people would like to have dinner?\n")if int(user_num) > ...原创 2018-03-26 21:46:00 · 597 阅读 · 0 评论 -
《Python编程 从入门到实践》第八章课后习题
8-1def display_message(): print("we will learn function in this chapter. ") display_message()8-2def favorite_book(title): print("One of my favorite books is " + title +". ") favorite_book(...原创 2018-04-02 01:19:29 · 371 阅读 · 1 评论 -
《Python编程 从入门到实践》第九章课后习题
9-1class Restaurant(): def __init__(self, r_name, c_type): self.restaurant_name = r_name self.cuisine_type = c_type def describe_restaurant(self): print("Restaurant Name: " + self.restau...原创 2018-04-05 09:47:38 · 515 阅读 · 0 评论 -
《Python编程 从入门到实践》第十章课后习题
10-1# coding:utf-8filename = 'learning_python.txt'# 读取整个文件with open(filename) as file_object: contents = file_object.read() print(contents.rstrip())# 遍历文件对象with open(filename) as file_o...原创 2018-04-05 19:19:57 · 501 阅读 · 0 评论 -
《Python编程 从入门到实践》第十一章课后习题
11-1import unittestdef get_location(country, city): return country.title() + ', ' + city.title();class LocationTestCase(unittest.TestCase): def test_city_country(self): location = ...原创 2018-04-14 10:33:34 · 525 阅读 · 0 评论 -
LeetCode #55 Jump Game
【问题描述】Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents yourmaximum jump length at that position.Determine if y...原创 2018-05-01 20:13:00 · 113 阅读 · 0 评论 -
LeetCode #120 Triangle
【问题描述】Given atriangle, find the minimum path sum from top to bottom. Each step you may moveto adjacent numbers on the row below.Forexample, given the following triangle[ [2], [3,4], [6,5,7], ...原创 2018-05-01 20:21:11 · 112 阅读 · 0 评论 -
LeetCode #4 Median of Two Sorted Arrays
【问题描述】There are two sorted arrays nums1 and nums2 ofsize m and n respectively.Find the median of the two sorted arrays.The overall run time complexity should be O(log (m+n)).Example 1:nums1= [1, 3]num...原创 2018-05-02 00:34:26 · 97 阅读 · 0 评论 -
LeetCode #198 House Robber
【问题描述】You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent...原创 2018-05-09 17:18:14 · 124 阅读 · 0 评论 -
LeetCode #213 House Robber II
【问题描述】After robbing those houses on that street, thethief has found himself a new place for his thievery so that he will not gettoo much attention. This time, all houses at this place are arranged in ...原创 2018-05-09 20:09:36 · 124 阅读 · 0 评论 -
LeetCode #134 Gas Station
【问题描述】There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to ...原创 2018-05-09 20:39:40 · 137 阅读 · 0 评论 -
特殊形式素数无穷性的证明
引理:任一形如3k-1, 4k-1, 6k-1形式的正整数必有相同形式的素因数。证明:(1)奇数可以表示为以下三种形式中的一种:3k−1,3k和3k+1。对于∀k1,k2∈Z,(3k1+1)(3k2+1)=3(3k1k2+k1+k2)+1,3k1⋅3k2=3(3k1k2),3k1(3k2+1)=3(3k1k2+k1),即形如3k+1的奇数的乘积仍形如3k+1,形如3k的奇数的乘积仍形如3k,形如...原创 2019-01-14 22:14:19 · 3409 阅读 · 1 评论