7 kyu

Asperand pixel counting

493 of 942artiekra

Description:

Description

You can paint an asperand by pixels in three steps:

  1. First you paint the inner square, with a side of k.
  2. Then you need to paint one pixel, that's laying diagonally relative to the inner square that you just painted ( the bottom-right corner of the inner square is touching the top-left corner of the pixel ). Let's call it the "bridge".
  3. Finally, you will need to paint the outer shape, connected diagonally to the "bridge" ( see the picture for more information ).

Here are some examples of this:

Examples for 0<k<5

Your task is to find the number of pixels that need to be painted, for different k:

k = 1 => 11
k = 2 => 18
k = 3 => 26
k = 4 => 34

# Limitations are 1  k  1e9

The idea for this kata was taken from the Ukrainian Informatics Olympiad 2023.

Algebra
Puzzles

Stats:

CreatedJan 28, 2023
PublishedJan 28, 2023
Warriors Trained2007
Total Skips37
Total Code Submissions3056
Total Times Completed942
Python Completions493
JavaScript Completions387
Haskell Completions36
λ Calculus Completions9
C Completions77
Scala Completions12
Total Stars19
% of votes with a positive feedback rating94% of 134
Total "Very Satisfied" Votes117
Total "Somewhat Satisfied" Votes17
Total "Not Satisfied" Votes0
Total Rank Assessments10
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • artiekra Avatar
  • JohanWiltink Avatar
  • rowcased Avatar
  • dfhwze Avatar
  • KayleighWasTaken Avatar
Ad