顯示包含「Xanga」標籤的文章。顯示所有文章
顯示包含「Xanga」標籤的文章。顯示所有文章

2010年7月25日星期日

[舊帖] PKU 2480 Longge's problem

原文位置:http://www.xanga.com/private/editorx.aspx?uid=721833838

這是2010年度 CSC3270 的功課...



題意:


給定 N
計算 ∑1≤i≤Ngcd(i, N)



算法:


Ans := 0
Foreach divisor of N, D
  Ans += D × Phi( N / D )
EndFor



證明:


留意到 GCD(i, N) 必然是 N 的某個因數

2010年7月2日星期五

[舊帖] UVa 11275 3D Triangles

Old Post in Xanga on 2010-02-18



Problem Statement:
Given 2 triangles in R3, check whether they share at least 1 common point.



今日 Research 有 3D 野要搞...
Google... 無意間見到 一個 theorem - SAT (?)
原 來 SAT = Separating Axis Theorem

發覺 ACM 可能有用喎!

應 用落呢題之後... Runtime 快過以前 Ray / Plane Intersection !
而且對比之下, 呢個方法更加 mechanical, 貌似好多地方都用得著