Tap here to switch tabs
Problem
Submissions

Problem: 4 Keys Keyboard

med
30 min
Try to solve the 4 Keys Keyboard problem.

Statement

You have a special keyboard with four keys:

  • Key 11 (A): Prints a single 'A' on the screen.

  • Key 22 (Ctrl A): Selects the entire screen.

  • Key 33 (Ctrl C): Copies the selected content into a buffer.

  • Key 44 (Ctrl V): Prints the buffer content onto the screen.

Given an integer n, return the maximum number of 'A' characters that can be displayed on the screen using at most n key presses.

Constraints:

  • 1≤1 \leq n ≤50\leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: 4 Keys Keyboard

med
30 min
Try to solve the 4 Keys Keyboard problem.

Statement

You have a special keyboard with four keys:

  • Key 11 (A): Prints a single 'A' on the screen.

  • Key 22 (Ctrl A): Selects the entire screen.

  • Key 33 (Ctrl C): Copies the selected content into a buffer.

  • Key 44 (Ctrl V): Prints the buffer content onto the screen.

Given an integer n, return the maximum number of 'A' characters that can be displayed on the screen using at most n key presses.

Constraints:

  • 1≤1 \leq n ≤50\leq 50