103470: [Atcoder]ABC347 A - Divisible
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:10
Solved:0
Description
Score: $100$ points
Problem Statement
You are given positive integers $N$ and $K$, and a sequence of length $N$, $A=(A_1,A_2,\ldots,A_N)$.
Extract all elements of $A$ that are multiples of $K$, divide them by $K$, and print the quotients.
Constraints
- $1\leq N,K\leq 100$
- $1\leq A_1 < A_2 < \ldots < A_N \leq 100$
- $A$ has at least one multiple of $K$.
- All given numbers are integers.
Input
The input is given from Standard Input in the following format:
$N$ $K$ $A_1$ $A_2$ $\ldots$ $A_N$
Output
Divide all elements of $A$ that are multiples of $K$ and print the quotients in ascending order with spaces in between.
Sample Input 1
5 2 2 5 6 7 10
Sample Output 1
1 3 5
The multiples of $2$ among the elements in $A$ are $2$, $6$, and $10$. Divide them by $2$ to get $1$, $3$, and $5$, and print them in ascending order with spaces in between.
Sample Input 2
3 1 3 4 7
Sample Output 2
3 4 7
Sample Input 3
5 10 50 51 54 60 65
Sample Output 3
5 6
Input
Output
分数:100分
问题描述
给你两个正整数N和K,以及一个长度为N的序列A=(A1,A2,……,AN)。
提取A中所有K的倍数,将它们除以K,并打印商。
约束条件
- 1≤N,K≤100
- 1≤A1<A2<……<AN≤100
- A至少有一个K的倍数。
- 所有给定的数都是整数。
输入
输入从标准输入按以下格式给出:
N K A1 A2 …… AN
输出
将A中所有K的倍数除以K,并按升序用空格分隔打印商。
样例输入1
5 2 2 5 6 7 10
样例输出1
1 3 5
A中2的倍数有2,6和10。将它们除以2得到1,3和5,然后按升序用空格分隔打印。
样例输入2
3 1 3 4 7
样例输出2
3 4 7
样例输入3
5 10 50 51 54 60 65
样例输出3
5 6