This problem i coined up by myself can pass as a Div4A right?

Revision en3, by comingsoon.cpp, 2024-02-12 17:18:37

I was trying to solve an exercise while studying basic probabilities and while solving the exercise, I thought of this problem which I thought was fun, so I decided to share it with my fellow noobs :)

Please if you're anything above a newbie, (in Ercole Visconti's voice) This problem is not for you (no offence) :)

Problem Statement

You have n tiles numbered from 1 through to n. You are also given an integer K. The task it to count all pairs of integers (a,b) from the n tiles whose difference is K. that means (a — b) = K

Input The one and only line of the input contains two positive integer n and K. Output Print the number of such pairs (a, b) whose difference is K, thank you.

Sample input 100 11 Sample output 89

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English comingsoon.cpp 2024-02-12 17:18:37 139
en2 English comingsoon.cpp 2024-02-12 17:12:17 1 Tiny change: 'er n and K\n**Output' -> 'er n and K.\n**Output'
en1 English comingsoon.cpp 2024-02-12 17:11:04 698 Initial revision (published)