Блог пользователя Koo_Pung-Kei

Автор Koo_Pung-Kei, 11 месяцев назад, По-английски

Read before:

This blog should be just taken as a witness of my progressions as well as ideas to inspire readers and will inevitably feature bad-looking code styles or non-best solutions. Better solutions to problems mentioned in the blog are welcome in your readers' comments.

All codes in this blog can be compiled in C++.

Hello, Codeforces!

The 4-year-struggle eventually got paid off when Codeforces Round 1028 (Div. 2) on May/31/2025 17:35 (Moscow time) had made me a pupil — firmly hope that the newbie age won't return later on!

The blog is a self-made editorial on ideas and codes for the round's first 3 problems. I do hope that this can inspire you as readers.

Jesus I publish this blog minutes later than the official one

2116A - Gellyfish and Tricolor Pansy

Ideas
Solution

2116B - Gellyfish and Baby's Breath

Ideas
Modulo Calculation with Exponential Operations
Solution

2116C - Gellyfish and Flaming Peony

Ideas
Solution

Again, the solution codes above may not be the best but it does work for the problems — you can reach to official editorial for details. I may be not as active as present later on because I've got a job as well as a upgrade already — I do hope the amateur editorial may inspire readers on similar problems later on and wish all readers have a pleasant coding experience.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

Автор Koo_Pung-Kei, 12 месяцев назад, По-английски

Read before:

According to what it seemed previously, the practice stage of Kotlin Heroes series contests may never be followed by official editorials and can not be submitted after it's finished. This blog aims to be an archive of problems, my corresponding ideas as well as submissions and some templates for faster Kotlin code editing later on.

All code blocks in this blog can be compiled with Kotlin only due to the contest's regulations.

Ahoj, Codeforces!

I had been absent from Codeforces along with Kotlin-only rounds for over one year thanks to my own business, but I kept waiting for the practice stage's initial return this year as I turn available for codings — the waiting eventually got paid off when Kotlin Heroes: Practice 12 was back with the relieving news to be held on Mar/31/2025 16:35 (Moscow time) and last for 7 days.

This blog is to share thoughts on Kotlin the language and to archive problems as well as solutions for the contest. I hope this will help readers obtain a better understanding of the designed-for-Android programming language.

Template as preparations

All code blocks as solutions below will be based on the template mentioned above.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Koo_Pung-Kei, 13 месяцев назад, По-английски

Hello, Codeforces!

I took a code capability test for a job in a company 4 days before so there's no need to worry about cheats and leaks, and one of the 4 problems has troubled me for so long that I have to come here for guidance and hints today.

The problem is as follows:


Dodo's Lucky Number Lottery

time limit per test: 1 second
memory limit per test: 256 megabytes

Dodo has discovered a brand-new type of scratch-off lottery ticket that will give prizes to those who scratch Lucky Numbers out. Lucky Numbers are natural numbers with substrings whose values are divisible by $$$3$$$ ($$$0$$$ included).

Given two integers $$$L$$$ and $$$R$$$ $$$(L\le R)$$$, Dodo wants to find out how many Lucky Numbers are there in the range $$$[L,R]$$$. But it's difficult, please help him!

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1\le t\le 2\times10^4)$$$.

Each test case will contain two integers $$$L$$$ and $$$R$$$ $$$(1\le L\le R\le 10^{18})$$$, the left and right end of the range in search of Lucky Numbers.

Output

For each test case, output the number of Lucky Numbers in the given range.

Example

Input

2
11 19
20 40

Output

6
18

Explanation

For the first test case, $$$[12,13,15,16,18,19]$$$ are Lucky Numbers.

For the second test case, $$$[20,21,23,24,26,27,29,30,31,32,33,34,35,36,37,38,39,40]$$$ are Lucky Numbers.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

Автор Koo_Pung-Kei, 13 месяцев назад, По-английски

Read before:

This blog should be just taken as a witness of my progressions as well as ideas to inspire readers and will inevitably feature bad-looking code styles or non-best solutions. Better solutions to problems mentioned in the blog are welcome in your readers' comments.

All codes in this blog can be compiled in Java.

Hello, Codeforces!

The Tsinghua University buddies have fought back against the failure of the based-on-Zhili-Cup Codeforces Round 1010 (Div. 2, Unrated), accompanied by a brand new rated Codeforces Round 1012 (Div. 2) which was held on Mar/23/2025 08:35 (Moscow time). Having taken the round as the only chance to establish an academic link with the top college in mainland China throughout my lifetime as a Chinese resident again, I struggled out of my noon break to take the meaningful challenge.

This blog is an editorial that will show my understanding of 3 problems of the 8 (or 6 if taking the 2 subtasks as 1) in the contest and the corresponding code blocks for solutions. I do hope that this can inspire you as readers.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится

Автор Koo_Pung-Kei, 13 месяцев назад, По-английски

Read before: I seldom succeed in killing the third problem before the finishing bell rings during any contests, and this time is no exception. The blog is just for inspiration and the codes given may not necessarily be the best one. Better thoughts are welcomed in the comment area from readers.

All codes in this blog can be compiled in Java.

Hello, Codeforces!

Held on Mar/10/2025 17:45 (Moscow time), Codeforces Round 1008 (Div. 2) was a mathematical and Arcaea-ful round for me as (at least is said by my rating after the participation) a newbie. The blog is to give thoughts (rather than giving the whole code block straightly) on the first 3 problems in the round, and I do hope this may inspire you as readers.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится