Description

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.

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.

题意:问1-z内,n*1,n*2,n*3...m*1,m*2...它们相同的有多少个

解法:那就。。保存一下再记录就好了,其实可以直接算出来

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
map<int,int>q,p;
map<int,int>::iterator it;
int a,b,c;
cin>>a>>b>>c;
for(int i=;i<=c;i++)
{
if(i*a>c) break;
q[i*a]=;
}
int sum=;
for(int i=;i<=c;i++)
{
if(i*b>c) break;
if(q[i*b]==)
{
sum++;
}
}
cout<<sum<<endl;
return ;
}

Codeforces Round #395 (Div. 2) A的更多相关文章

  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) D. Timofey and rectangles

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

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

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

  5. Codeforces Round #395 (Div. 1)

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

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

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

  7. Codeforces Round #395 (Div. 2)

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

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

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

  9. 【树形DP】Codeforces Round #395 (Div. 2) C. Timofey and a tree

    标题写的树形DP是瞎扯的. 先把1看作根. 预处理出f[i]表示以i为根的子树是什么颜色,如果是杂色的话,就是0. 然后从根节点开始转移,转移到某个子节点时,如果其子节点都是纯色,并且它上面的那一坨结 ...

  10. Codeforces Round #395 (Div. 2) C

    题意 : 给出一颗树 每个点都有一个颜色 选一个点作为根节点 使它的子树各自纯色 我想到了缩点后check直径 当<=3的时候可能有解 12必定有解 3的时候需要check直径中点的组成点里是否 ...

随机推荐

  1. this、call和apply、bind

    this关键字: JavaScript的this关键字,总是指向一个对象,具体指向哪个对象,是根据运行时函数指向环境动态绑定的.简单来说,this就是谁调用指向谁.具体使用中,this的指向,大致可以 ...

  2. I want a mysqldump –ignore-database option

    $ time mysqldump --databases `mysql --skip-column-names -e "SELECT GROUP_CONCAT(schema_name SEP ...

  3. DCOS之Mesos-DNS介绍

    DCOS的Mesos-DNS它主要提供域名解析服务,Mesos-DNS 在DCOS框架中支持服务发现,同意应用程序和服务通过域名系统(DNS)来相互定位.DCOS中的 Mesos-DNS充当的角色和在 ...

  4. python day - 09 函数

    函数 1.函数的定义,引用. 定义:函数是对功能和代码块的封装和定义. 函数用 def关键字来表示. 格式: def  函数名(): 函数体 eg: return(返回值) 在函数中遇到return ...

  5. JasperReport 中文问题解决

    1 运行环境    1.1 JasperReport 3.5    JasperReports 是iReport的核心内容.它是一个强有力的开源报表产生工具,可以将内容输出到屏幕上.打印机或生成PDF ...

  6. safair 的css hack

    在css里面使用[;attribute:value;] css参考如下: .header-share li{float: right; margin-left: 20px; [;width: 50px ...

  7. Android上的水果忍者刀锋效果(JAVA实现)

    显示刀锋的View package com.wbhuang.myninjia; import java.util.ArrayList; import java.util.List; import an ...

  8. delphi 八字排盘源码(post数据以后,又分析数据)

    procedure TForm1.Button14Click(Sender: TObject);var  ls: TStringList;  lstr: string;  lss: TMemorySt ...

  9. YTU 2422: C语言习题 n个数逆序

    2422: C语言习题 n个数逆序 时间限制: 1 Sec  内存限制: 128 MB 提交: 150  解决: 96 题目描述 将n(n<20)个数按输入时顺序的逆序排列,用函数实现. 输入 ...

  10. html5--6-59 其他常用CSS属性

    html5--6-59 其他常用CSS属性 实例 学习要点 了解opacity属性:透明度设定 了解cursor属性:自定义鼠标样式 了解CSS新单位rem和em的区别 了解轮廓outline的设置 ...