原创 C++讀取文件爲何會多讀一行?

近來在做概率統計的作業,由於手算均值中值什麼的,還有畫莖葉圖太麻煩,所以寫了個小程序。但是當我算到最後時卻發現這個小程序有一個bug,然後就gg了。這個bug大概是這樣的: 原本在data.txt中只有三個數,讀到內存中卻有四

原创 LeetCode題解系列--188. Best Time to Buy and Sell Stock IV

描述 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to f

原创 Unity3D筆記(一)基礎知識學習筆記

一、解釋對象與資源的區別與聯繫,根據官方案例,分別總結資源和對象組織的規則/規律 資源指的是遊戲中那些直接可見的、對用戶展現出的元素,包括圖片、音樂、視頻、人物、字體。 對象指的是數據?資源的載體? 資源可以被很多對象複用,很

原创 CONTAINER類之心得體會

第一次博客難免有錯誤,歡迎大家批評指正,共同進步 其實容器類就是一個有各種容器的接口,通過C++繼承與多態的特性,能夠自由的往容器類中添加各種數據結構。上圖就是這個容器類的基本結構。其中帶箭頭的線表示繼承關係、帶矩形的線表示組成

原创 LeetCode題解系列--684. Redundant Connection

描述 In this problem, a tree is an undirected graph that is connected and has no cycles. The given input is a graph t

原创 C++之繼承

C++ 繼承 語法 程序設計 軟件工程 若有理解不當,歡迎各位指正! 作者:吳博文 中山大學數據科學與計算機學院 本人博客:http://blog.csdn.net/bowen_wu_ 一、繼承基本概念 通過繼承,所構建的新

原创 歡迎使用CSDN-markdown編輯器

歡迎使用Markdown編輯器寫博客 本Markdown編輯器使用StackEdit修改而來,用它寫博客,將會帶來全新的體驗哦: Markdown和擴展Markdown簡潔的語法 代碼塊高亮 圖片鏈接和圖片上傳 LaTex數學公

原创 Unity3D筆記(二)使用GUI做井字棋小遊戲

第一次使用unity, 做點事情就比較笨。簡單的事情也做了許久,主要是對unity這個引擎邏輯不熟悉,對C#這個語言的邏輯也不是很熟,走了許多彎路。 開始想的是真的有九個格子那樣的對象,然後有一箇中控對象去負責統計結果,然後發現

原创 LeetCode題解系列--215. Kth Largest Element in an Array

描述 Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not

原创 LeetCode題解系列--1. Two Sum

描述 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may as

原创 LeetCode題解系列--309. Best Time to Buy and Sell Stock with Cooldown

描述 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find

原创 Unity3D筆記(三)牧師和魔鬼的遊戲

這次做的是一個魔鬼和牧師的遊戲 遊戲DEMO Priests and Devils is a puzzle game in which you will help the Priests and Devils to cross

原创 習題8.15

題目 Show that the following problem is NP-complete. MAXIMUM COMMON SUBGRAPH Input: Two graphs G1 = (V1, E1) and G2 = (

原创 LeetCode題解系列--121. Best Time to Buy and Sell Stock

描述 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted t

原创 Unity3D學習筆記(四)牧師和魔鬼遊戲改進

在上次做的牧師和魔鬼的遊戲中,場記基本負責了所有的工作,加載資源,移動遊戲對象,很明顯這樣的遊戲結構很難維護,很難拓展,很不面向對象,所以這次的工作就是利用工廠模式來生產動作。彌補了上次沒有上船動作的缺點。 先上UML圖: UML圖