303970: CF764A. Taymyr is calling you

Memory Limit:255 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Taymyr is calling you

题意翻译

输入三个数n,m,z。 这一天总共有z分钟。 从第n分钟开始,n,2n,3n...分钟Ilia-alpinist都会打个电话过来(直到这天结束)。 从第m分钟开始,m,2m,3m...分钟都会来一个艺术家,待满这一分钟就走(直到这天结束)。 如果Ilia-alpinist打电话的时候恰好来了一个艺术家,这个艺术家就要被杀掉。 输出一个数s,为被杀艺术家的人数。 Translated by @AdzearDisjudge

题目描述

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 $ , $ 2n $ , $ 3n $ and so on. Artists come to the comrade every $ m $ minutes, i.e. in minutes $ m $ , $ 2m $ , $ 3m $ 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.

输入输出格式

输入格式


The only string contains three integers — $ n $ , $ m $ and $ z $ ( $ 1<=n,m,z<=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.

Input

题意翻译

输入三个数n,m,z。 这一天总共有z分钟。 从第n分钟开始,n,2n,3n...分钟Ilia-alpinist都会打个电话过来(直到这天结束)。 从第m分钟开始,m,2m,3m...分钟都会来一个艺术家,待满这一分钟就走(直到这天结束)。 如果Ilia-alpinist打电话的时候恰好来了一个艺术家,这个艺术家就要被杀掉。 输出一个数s,为被杀艺术家的人数。 Translated by @AdzearDisjudge

加入题单

上一题 下一题 算法标签: