

Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 点
問題文
すぬけくんは鉄道会社を運営するゲームで遊ぶことにしました。すぬけ鉄道には 個の駅があり、 から までの番号がついています。 すぬけ鉄道の列車は駅 から 駅ごとに停車します。 例えば のとき駅 ,駅 ,駅 ,駅 , に停車します。
すぬけ鉄道が走っている地域には 種類の名産品があり、種類 の名産品は 駅 ,駅 ,駅 , , 駅 のいずれかに列車が停車したとき購入することが可能です。
列車が停車する間隔 は の 種類が存在しています。 種類の列車それぞれについて、その列車に駅 で乗車した場合に購入可能な名産品の種類数を求めなさい。 なお、列車から別の列車への乗り換えは許されないものとします。
制約
入力
入力は以下の形式で標準入力から与えられる。
出力
答えを 行に出力せよ。 行目では 駅ごとに停車する列車に乗った場合に購入可能な名産品の種類数を出力せよ。
入力例 1Copy
3 3 1 2 2 3 3 3
出力例 1Copy
3 2 2
- 駅ごとに停車する列車に乗った場合、種類 の 種類の名産品を購入することが可能です。
- 駅ごとに停車する列車に乗った場合、種類 の 種類の名産品を購入することが可能です。
- 駅ごとに停車する列車に乗った場合、種類 の 種類の名産品を購入することが可能です。
入力例 2Copy
7 9 1 7 5 9 5 7 5 9 1 1 6 8 3 4
出力例 2Copy
7 6 6 5 4 5 5 3 2
Score : points
Problem Statement
Snuke has decided to play a game, where the player runs a railway company. There are stations on Snuke Line, numbered through . A train on Snuke Line stops at station and every -th station thereafter, where is a predetermined constant for each train. For example, if , the train stops at station , , , , and so forth.
There are kinds of souvenirs sold in areas around Snuke Line. The -th kind of souvenirs can be purchased when the train stops at one of the following stations: stations , , , , .
There are values of , the interval between two stops, for trains on Snuke Line: , , , , . For each of these values, find the number of the kinds of souvenirs that can be purchased if one takes a train with that value of at station . Here, assume that it is not allowed to change trains.
Constraints
Input
The input is given from Standard Input in the following format:
Output
Print the answer in lines. The -th line should contain the maximum number of the kinds of souvenirs that can be purchased if one takes a train stopping every -th station.
Sample Input 1Copy
3 3 1 2 2 3 3 3
Sample Output 1Copy
3 2 2
- If one takes a train stopping every station, three kinds of souvenirs can be purchased: kind , and .
- If one takes a train stopping every second station, two kinds of souvenirs can be purchased: kind and .
- If one takes a train stopping every third station, two kinds of souvenirs can be purchased: kind and .
Sample Input 2Copy
7 9 1 7 5 9 5 7 5 9 1 1 6 8 3 4
Sample Output 2Copy
7 6 6 5 4 5 5 3 2