3379 - I2P(I)2026_Hu_Lab6 Scoreboard

Time

2026/11/10 18:40:00 2026/11/10 20:40:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
15083 Cocos Creater
15084 String decompress

15083 - Cocos Creater   

Description

" Please don't CoCo everywhere, and spend all of your CoCos. Without notice, you'll run out of CoCos, whoa-whoa"

— JJ Lin, If you're not trendy, you don't have to spend money

Capybara and CabiCabi have recently made a groundbreaking discovery! The tea shop CoCo near NTHU gives you a discount coupon after every purchase, which allows you to buy an 80 NTD coffee for just 25 NTD on your next visit, and that purchase will instantly give you another coupon — they have basically found an endless loop of 25 NTD coffee!

Such unbelievably cheap prices make them unable to resist buying a cup every time they pass by. However, the cost still adds up over time, so they must come up with a more cost-effective strategy. Capybara suggested seeking help from Lizard Tom! It is rumored that Lizard Tom has recently been studying a software called "cocos creator". Although they have no idea what it is actually used for, it sounds like something capable of generating a massive amount of CoCo.


Lizard Tom has something he'd like to say: he indeed possesses the technology to create CoCo, but he has no control over the exact amount he produces.

Specifically, if CabiCabi gives him an order of cups of CoCo, the actual number of cups Lizard Tom produces will be , which is defined as follows:

L... L for Lizard! Huh? What is a function? I always predict the amount of generated CoCo by guessing!

As everyone knows, Lizard Tom is terrible at math because he never pays attention during dyy's classes. To prevent the tragedy of "CoCo everywhere" from happening, please write a program to help Capybara and CabiCabi calculate exactly how many cups of CoCo Lizard Tom will ultimately produce when they place an order for cups.

Hint

  • is equivalent to , as long as there's no division in your eqution, you can take mod at anytime you want
  • is SUPER BIG. You don't need to worry about large number calculations, because Python will handle it for you. But obviously, creating a list with size isn't a good idea. Furthermore, you wouldn't want to repeatedly calculate known values.
  • If you receive RE or MLE due to Floating-point accuracy problem, try using // instead of math.floor + /

Input

The first line contains a single positive integer T, representing the number of testcases

Each testcase contains a single positive integer , representing the number of CoCo cups originally ordered from Lizard Tom.

Constraints

Subtasks

  • For Testcases 1 ~ 3,
  • For Testcases 4 ~ 6,
  • For Testcases 7 ~ 10,

Output

For each testcase, print a single integer in a new line, representing the number of CoCo cups ultimately produced by Lizard Tom.

Sample Input  Download

Sample Output  Download

Tags




Discuss




15084 - String decompress   

Description

Capybara is a system engineer who needs to process a massive volume of packets from the server daily.
To reduce network bandwidth consumption, the server uses a specialized text compression format:

 

[S]N

 

This means the content inside the brackets is repeated times.

For example:

[abc]3

Will be decompressed as:

abcabcabc

Brackets can also be nested. For example:

A[b[12]2]3C

Will be decompressed as:

Ab1212b1212b1212C

Today, Capybara needs to fully restore the packet data.
However, he faces some problems, he doesn't know how to decompress it back. He then asked his friend, CABI-bara, CABI-bara also had no idea, but he knew that our I2P students are brillant, so he decided to make it a homework assignment, letting every I2P students to slove it for them.

Given a compressed string, please output the fully decompressed string.

Compression rules

  • [S]N means is repeated times, where is a positive integer.
  • Each ] is immediately followed by at least one digit, representing the number of repetitions.
  • The repetitoin count can be a multi-digit number.
  • Brackets can be nested.
  • The string can contain uppercase/lowercase English letters, digits, and printable characters. However, [ and ] are strictly used for the compression syntax.
  • It is guaranteed that the input format is valid.

Input

The input contains only one line, which is a valid compressed string.

  •  
  •  
  •  
  •  

Output

Output a single line containing the fully decompressed string.

Sample Input  Download

Sample Output  Download

Tags




Discuss