A. Taymyr is calling you
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 everym 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.

Input

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

Output

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

Examples
input
1 1 10
output
10
input
1 2 5
output
2
input
2 3 9
output
1
Note

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.

【题意】:某人每间隔n分钟打一次房间内电话,而一些人每间隔m分钟就进入房间,要阻挠多少个人才能保证在一定时间段z内电话无人接听?


让你求1-z之间有多少数既是n的倍数又是m的倍数(n,m的最小公倍数)。

【代码】:

#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f int main()
{
int n,m,k;
while(cin>>n>>m>>k)
{
cout<<k/(n/(__gcd(n,m))*m)<<endl;
}
return 0;
}

  

Codeforces Round #395 (Div. 2) A. Taymyr is calling you【数论/最小公倍数】的更多相关文章

  1. Codeforces Round #395 (Div. 2)(A.思维,B,水)

    A. Taymyr is calling you time limit per test:1 second memory limit per test:256 megabytes input:stan ...

  2. Codeforces Round #395 (Div. 2)(未完)

    2.2.2017 9:35~11:35 A - Taymyr is calling you 直接模拟 #include <iostream> #include <cstdio> ...

  3. Codeforces Round #395 (Div. 2)

    今天自己模拟了一套题,只写出两道来,第三道时间到了过了几分钟才写出来,啊,太菜了. A. Taymyr is calling you 水题,问你在z范围内  两个序列  n,2*n,3*n...... ...

  4. Codeforces Round #395 (Div. 2) D. Timofey and rectangles

    地址:http://codeforces.com/contest/764/problem/D 题目: D. Timofey and rectangles time limit per test 2 s ...

  5. Codeforces Round #395 (Div. 2) C. Timofey and a tree

    地址:http://codeforces.com/contest/764/problem/C 题目: C. Timofey and a tree time limit per test 2 secon ...

  6. Codeforces Round #395 (Div. 2)B. Timofey and cubes

    地址:http://codeforces.com/contest/764/problem/B 题目: B. Timofey and cubes time limit per test 1 second ...

  7. Codeforces Round #395 (Div. 2) A

    Description Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls f ...

  8. Codeforces Round #395 (Div. 1)

    比赛链接:http://codeforces.com/contest/763 A题: #include <iostream> #include <cstdio> #includ ...

  9. 【分类讨论】Codeforces Round #395 (Div. 2) D. Timofey and rectangles

    D题: 题目思路:给你n个不想交的矩形并别边长为奇数(很有用)问你可以可以只用四种颜色给n个矩形染色使得相接触的 矩形的颜色不相同,我们首先考虑可不可能,我们分析下最多有几个矩形互相接触,两个时可以都 ...

随机推荐

  1. WINDOWS选择目录SHBrowseForFolder使用方法介绍

    首先介绍一个兼容Unicode和多字节的方法,定义如下头文件: // TString.h; #pragma once #include <string> #ifdef UNICODE ty ...

  2. NOIP2016提高A组 A题 礼物—概率状压dp

    题目描述 夏川的生日就要到了.作为夏川形式上的男朋友,季堂打算给夏川买一些生 日礼物. 商店里一共有n种礼物.夏川每得到一种礼物,就会获得相应喜悦值Wi(每种礼物的喜悦值不能重复获得). 每次,店员会 ...

  3. Django项目:CMDB(服务器硬件资产自动采集系统)--04--04CMDB本地(Agent)模式客户端唯一标识(ID)

    # client.py # ————————01CMDB获取服务器基本信息———————— from src import plugins #__init__.py from lib.serializ ...

  4. 大牛就别进来了.npm --save-dev --save 的区别

    --save-dev 是你开发时候依赖的东西,--save 是你发布之后还依赖的东西. 比如,你写 ES6 代码,如果你想编译成 ES5 发布那么 babel 就是devDependencies.如果 ...

  5. (二)通过JAVA调用SAP接口 (增加一二级参数)

    (二)通过JAVA调用SAP接口 (增加一二级参数) 一.建立sap连接 请参考我的上一篇博客 JAVA连接SAP 二.测试项目环境准备 在上一篇操作下已经建好的环境后,在上面的基础上新增类即可 三. ...

  6. 原生JS实现彩票36选7不重复(优化)

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  7. css之页面三列布局之左右两边宽度固定,中间自适应

    左右两边宽度固定,中间自适应 左右两边绝对定位 可以利用浮动,左边的左浮动,右边的右浮动 css3 flex布局(html http://www.cnblogs.com/myzy/p/5919814. ...

  8. hdu1863畅通工程

    畅通工程 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  9. canvas绘制video

    html <video style="position: relative; object-fit: fill;" preload="auto" id=& ...

  10. Yii 网站上线不需手动配置

    参考: http://www.cnblogs.com/x3d/p/php_auto_prepend_file.html