程式隨筆

Never give up!


  • Home

  • Categories

  • Archives

  • Tags

Latex Notes

Posted on 2016-08-20 | In Latex

Latex is a great way to express mathematical expressions in a clear and readable way, just like what you see in textbooks. The setup is tedious, and the usage is even messier.

The following notes are what I usually use for writing posts. Hope it can help you master Latex without the need to go through all pains that I have experienced.

Read more »

Codeforces Educational Round 13 Problem D

Posted on 2016-08-20 | In Competitive Programming , Codeforces

CFEdu13D Iterated Linear Function

Solution Sketch

Observe the following formula, you can see that the answer is hidden in it!

$$\begin{aligned} \begin{bmatrix} a & b \\ 0 & 1 \\ \end{bmatrix}^{n} \begin{bmatrix} x \\ 1 \\ \end{bmatrix} = \begin{bmatrix} f_n\\ 1 \\ \end{bmatrix} \end{aligned}$$
Read more »

Codeforces Educational Round 9 Problem D

Posted on 2016-08-19 | In Competitive Programming , Codeforces

CFEdu9D Longest Subsequence

Solution Sketch

If a number $b$ can be divided by a number $a$, then this number $a$ can be contained in $b$’s LCM subsequence.

Recall how we build up prime table using Sieve of Eratosthenes, we mark all multiples of a certain number $x$ if $x$ is a prime. We can use the same technique for this problem!

Read more »

UVa 10600

Posted on 2016-08-18 | In Competitive Programming , UVa

ACM Contest and Blackout

Solution Sketch

Suppose we have a set $S$ which represents all edges that are in MST, and a set $P$ represents all edges that are not in MST.

The crucial observation for getting the next-to-minimal spanning tree is: it can be obtained by adding one edge from $P$ and removing the edge from $S$ which caused the loop after adding an edge from $P$.

Read more »

Install Disqus on Hexo

Posted on 2016-08-18

Install Disqus on Hexo

  1. Sign up for an account on Disqus. After signing up, you will be given a disqus shortname for your website.
  2. Add the disqus shortname to your theme’s _config.yml. To be specific, update disqus_shortname: your-disqus-shortname

You should be good to go!

Usage

The comments should be automatically added to every post that you have published. To disable the commenting feature on any of the post, add comments: false at the post’s front-matter part of the .md file

UVa 10369

Posted on 2016-08-17 | In Competitive Programming , UVa

Arctic Network

Solution Sketch

Build a MST using Kruskal algorithm.

The curcial observation to solving this problem is $s$ satellites can save you $s - 1$ edges in the MST!

Read more »

UVa 11402

Posted on 2016-08-15 | In Competitive Programming , UVa

Ahoy, Pirates!

Solution sketch

The key thing to come up with is how to store the data and operations.

Read more »

Codeforces Round 367 Div2 Problem D

Posted on 2016-08-12 | In Competitive Programming , Codeforces

CF706D Vasiliy’s Multiset

Solution Sketch

We know that $ 1 \oplus 0 = 0 \oplus 1 = 1$ and $ 0 \oplus 0 = 1 \oplus 1 = 0$ ($\oplus$ stands for XOR). Thus, in order to find the maximum XOR value of two numbers, we need to choose a number such that it has as many opposite bits as possible regarding $x$.

How can we do it efficiently? Binary trie is here to save us!

Read more »

UVa 11300

Posted on 2016-08-09 | In Competitive Programming , UVa

Spreading the Wealth

Solution sketch

For every position $i$, we can define a variable $x_i$ which stores the number of coins that are being transferred from position $i + 1$ to $i$.

Read more »

How to write and publish articles on Hexo

Posted on 2016-08-05

Writing Articles

  1. Use hexo new __ARTICLE_NAME__ to let Hexo automatically create a new __ARTICLE_NAME__.md file in _posts folder for you.
  2. Edit the __ARTICLE_NAME__.md directly, and run hexo server to see the resulting webpage directly.
    • Use <!-- more --> in the post to control excerpt accurately

P.S. (Unrelated to the usage) Equation vs Formula: A formula is a special type of equation that shows the relationship between different variables

Writing Drafts

  1. Use hexo new draft __ARTICLE_NAME__ to let Hexo automatically create a new __ARTICLE_NAME__.md file in _drafts folder for you.
  2. Edit the __ARTICLE_NAME__.md directly, and run hexo server --draft to see the resulting webpage directly.
  3. Use hexo publish draft __ARTICLE_NAME__ to publish the draft.
1…567
Henry Tseng

Henry Tseng

64 posts
18 categories
57 tags
© 2017 Henry Tseng
Powered by Hexo
Theme - NexT.Pisces