Algorithm


Problem Name: beecrowd | 2968

Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2968

Hour for a Run

 

By Maratona SBC de Programação BR Brazil

Timelimit: 1

Vinicius takes his fitness very seriously, and every morning at 6 a.m., rain or shine, in summer and winter, he runs in a track around a pond. Along the race track there are N equally spaced signs. To not be discouraged from exercising, Vinicius counts the number of signs he has passed and checks to see if he has run at least 10%, at least 20%, . . . , at least 90% of his training.

Let’s help Vinicius by calculating for him the number of signs he needs to count to have completed at least 10%, 20%, . . . , 90% of his training, given the number of laps he wants to run and the total number of signs along the track

For example, suppose Vinicius wants to run 3 laps and the track has 17 signs. To ensure that he has run at least 30% of his training, he needs to count 16 signs. To guarantee at least 60%, he needs to count 31 signs.

 

Input

 

The input consists of a single line, which contains two integers, V and N (1 ≤ V, N ≤ 104 ), where V is the desired number of laps and N is the number of signs along the track.

 

Output

 

Your program must output a single line, containing nine integers, representing the numbers of signs that must be counted to ensure that at least 10%, 20%, . . . , 90% of the training has been completed, respectively.

 

 

 

Input Samples Output Samples

3 17

6 11 16 21 26 31 36 41 46

 

 

 

5 17

9 17 26 34 43 51 60 68 77

 

 

 

3 11

4 7 10 14 17 20 24 27 30

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>

#define true 1
#define false 0

int main(int argc, char **argv)
{

    int v, n, i;

    scanf("%d %d", &v, &n);

    for (i = 1; i  <  10; ++i)
        printf("%d%c", (i * v * n) % 10 ? ((i * v * n) / 10) + 1 : (i * v * n) / 10, i < 9 ? ' ' : '\n');

    return 0;

}
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 17

Output

x
+
cmd
6 11 16 21 26 31 36 41 46

#2 Code Example with Javascript Programming

Code - Javascript Programming


const { readFileSync } = require("node:fs")
const [V, N] = readFileSync("/dev/stdin", "utf8")
	.split(" ", 2)
	.map((value) => Number.parseInt(value, 10))

function main() {
	const output = Array.from(
		{ length: 9 },
		(_, i) => Math.ceil((V * N) / 10 * (i + 1))
	)

	console.log(output.join(" "))
}

main()

Copy The Code & Try With Live Editor

Input

x
+
cmd
3 17

Output

x
+
cmd
6 11 16 21 26 31 36 41 46

#3 Code Example with Javascript Programming

Code - Javascript Programming


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
const [a, b] = lines.shift().trim().split(" ");
const total = parseInt(a) * parseInt(b);
let string = "";

for(let i = 10; i  <  100; i += 10){
  if(i == 10){
    string += `${Math.ceil((total * i) / 100)}`
  }
  
  else{
    string += ` ${Math.ceil((total * i) / 100)}`
  }
}
console.log(string);
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 17

#4 Code Example with Python Programming

Code - Python Programming


from math import ceil
v, n = [int(x) for x in input().split()]
t = v*n
m = []
for i in range(10, 100, 10): m.append(ceil(i*t/100))
print('{} {} {} {} {} {} {} {} {}'.format(*m))
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 17
Advertisements

Demonstration


Previous
#2963 Beecrowd Online Judge Solution 2963 Buffoon Solution in C, C++, Java, Js and Python
Next
#2982 Beecrowd Online Judge Solution 2982 The Strike Stops or Continues? Solution in C, C++, Java, Js and Python