Problem Description
Problem Analysis
Ah
Pascal’s triangle
I feel this one is worth talking about
Pascal’s triangle was the problem I did on the lab machine when I first joined the ACM association
According to the seniors back then, it was the hardest of all the problems at the time
(So getting into the association was actually pretty easy)
Once you’ve done this one, you don’t need to do any of the others…‘
But this particular way of writing it is a formula-based approach I came up with before joining the association
That is, based on
the m-th number in row n can be expressed as C(n-1,m-1)
which is the number of combinations of choosing m-1 elements from n-1 distinct elements
Using this formula, you can do it with variables and loops
| |
But the derivation process is still quite time-consuming for a beginner
So when I actually did it, I still went with the traditional two-dimensional array
| |
It’s a problem with some commemorative meaning too~