CF764A.Taymyr is calling you

入门

通过率:0%

时间限制:1.00s

内存限制:255MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taymyr from Ilia-alpinist.

Ilia-alpinist calls every n minutes, i.e. in minutes n, 2_n_, 3_n_ and so on. Artists come to the comrade every m minutes, i.e. in minutes m, 2_m_, 3_m_ and so on. The day is z minutes long, i.e. the day consists of minutes 1, 2, ..., z. How many artists should be killed so that there are no artists in the room when Ilia calls? Consider that a call and a talk with an artist take exactly one minute.

杜吉科夫同志正忙着为季莫费的生日挑选艺术家,此时他接到了来自泰梅尔的伊利亚-登山家的电话。

伊利亚-登山家每 nn 分钟打一次电话,即在第 nn、2n2n、3n3n、…… 分钟时打电话。艺术家们每 mm 分钟来一次,即在第 mm、2m2m、3m3m、…… 分钟时到来。一天共持续 zz 分钟,即一天包含分钟 1, 2, …, z1,\ 2,\ \dots,\ z。为了让伊利亚打电话时房间里没有艺术家,需要“清除”多少名艺术家?注意:一次通话和与一名艺术家的交谈均恰好占用一分钟。

输入格式

The only string contains three integers — n, m and z (1 ≤ n, m, z ≤ 104).

唯一的一行字符串包含三个整数——nn、mm 和 zz(1 ≤ n, m, z ≤ 1041 \leq n, m, z \leq 10^4)。

输出格式

Print single integer — the minimum number of artists that should be killed so that there are no artists in the room when Ilia calls.

输出一个整数——即需要杀死的艺术家的最少人数,使得当伊利亚打电话时,房间里没有艺术家。

输入输出样例

  • 输入#1

    1 1 10

    输出#1

    10
  • 输入#2

    1 2 5

    输出#2

    2
  • 输入#3

    2 3 9

    输出#3

    1

说明/提示

Taymyr is a place in the north of Russia.

In the first test the artists come each minute, as well as the calls, so we need to kill all of them.

In the second test we need to kill artists which come on the second and the fourth minutes.

In the third test — only the artist which comes on the sixth minute.

泰梅尔是俄罗斯北部的一个地方。

在第一个测试中,艺术家和电话呼叫每分钟都会到来,因此我们需要消灭所有艺术家。

在第二个测试中,我们需要消灭在第 2 分钟和第 4 分钟到来的艺术家。

在第三个测试中——仅需消灭在第 6 分钟到来的艺术家。

输入解题思路,AI测评打分。不知道怎么写?

首页