主要是研究所時期做的一些投影片,少部份是後來做的:
2025年9月24日 星期三
"8 Kyu":Never visit a . . . !?特解
這題我是用暴力解的.但解了之後,看別人其實有特解,
就是直接輸出9-apple
原因在於:
假設n 是a + 10*b + 100*c + 1000*d
Sum all the digits of n的結果是s.
s=a+b+c+d
2. Subtract the sum from n, and it is your new n.
所以 new n = n - s
= a + 10*b + 100*c + 1000*d - (a + b + c + d)
= 9*b + 99*c + 999*d
所以一定是9的倍數。
其餘不是千位數的n類推,也是9的倍數
3. If the new n is in the list below return the associated fruit, otherwise return back to task 1.
...
9-apple
...
18-apple
...
27-apple
...
36-apple
...
45-apple
...
54-apple
...
63-apple
...
72-apple
...
81-apple
...
90-apple
91-kiwi
92-banana
93-kiwi
94-banana
95-melon
96-banana
97-melon
98-pineapple
99-apple
100-pineapple
9的倍數,相關的水果一定是apple.不會是別的。
Swift storyboard for FitAutoTest 雜記
info.plist:
看是Ordinary.storyboard 還是 TabView.storyboard ?
在info.plist:
Main storyboard file base name (macOS): Ordinary
則是Ordinary
==========================================
實際在跑的<project_name>_<station_name>.plist
以branch B495_Pizza為例:
PlistHelper.swift:
func getStationProjectName() -> String {
return "\(self.getProjectName())_\(self.getStationName())"
}
B44445_QT2Flow.swift:
SAP109_MBFlow.swift:
ConcurrentFlow.swift:
...
let stationProjectName = self._plistHelper!.getStationProjectName()
let testList = TestListFactory.getTestList(stationProjectName: stationProjectName)
...
TestListFactory.swift:
class TestListFactory {
static func getTestList(stationProjectName: String) -> ITestList? {
switch stationProjectName {
case "B444445_QT2":
return B444445_QT2List()
...
case "B495_Pizza":
return B495_PizzaList()
...
case "B499_Pizza":
return B499_PizzaList()
case "Test_Pizza": // Temp 20250219
return B495_PizzaList()
default:
return nil
}
}
}
==========================================
FitAutoTest, 找出程式GUI的start,
Ordinary.storyboard點兩下,
Start Btn0 -> Show the Connections inspector
Referencing Outlets
看到叫做startBtn0
Sent Actions
看到Ordinary Controller
dutStart0
OrdinaryController.swift:
@IBAction func dutStart0(_ sender: Any) {
super.handleStartBtnClick(dutIndex: 0)
}
BaseViewController.swift:
...
self.startBtnList = [startBtn0, startBtn1, startBtn2, startBtn3]
func handleStartBtnClick(dutIndex: Int){
...
if self.setUIAfterStart(dutIndex: dutIndex, isAlarm: true) {
...
self.startBtnList[dutIndex].isEnabled = false
self._testflow!.testStart(startTime: startTime, allDutIndexSnMap: [dutIndex: self.snTextFieldList[dutIndex].stringValue])
..
}
}
ITestFlow.swift:
protocol ITestFlow {
...
func testStart(startTime: Date, allDutIndexSnMap: Dictionary<Int, String>) -> ()
}
B444445_QT2Flow.swift:
class B444445_QT2Flow : ITestFlow {
...
func testStart(startTime: Date, allDutIndexSnMap: Dictionary<Int, String>) {
...
for i in 0...plistTestItems.count - 1 {
let pItem = plistTestItems[i]
//add into DispatchGroup
queue.async(group: group) {
let eachfunc = testList!.testItemScript[pItem.Script]
if eachfunc != nil {
...
var resultItem = eachfunc!(container)
...
}
}
Scribd
主要是研究所時期做的一些投影片,少部份是後來做的: https://www.scribd.com/user/21556865/davidsmc
-
今天中午,跟老姐一起看一公升的眼淚DVD, 後來老媽也加入來看, 看完之後,覺得還不錯, 劇中維持日劇一貫的風格,場景不多, 音樂非常優美,出場的人物不多, 主要圍繞在亞也、亞也他媽媽和醫生、同學間, 一公升的眼淚,是在1986年出的,現在也有中譯版了, 有興趣的網友可以去 博客...
-
之前安裝photoshop CS2常常不能破解, 今天總算安裝成功, 原來是忘了執行"crack.exe"。 詳細step as follows: 1.安裝photoshop cs2,在安裝過程中,必須"一直按下一步", 不能改目錄位置,也...
-
不曉得是Pygame本身的缺陷或bug,Pygame程式執行一段時間,必需要呼叫event一下,否則程式會變成沒有回應的情況,而程式畫面也會暫時停止更新。解決方法,就是確定程式沒互動時,get一下event,但也不是隨時都可以get event,因為當有event要處理時,例如...