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. &lt;十二&gt;读&lt;&lt;大话设计模式&gt;&gt;之状态模式

    对于状态模式,<<大话设计模式>>是以人从上班到下班到加班的状态来展开讲述的.状态模式事实上就是某一个对象在某个过程或者时间的一个状态记录,可是这个状态的顺序不能发生变化.在程 ...

  2. 杭电(hdu)1181 变形课

    变形课 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submi ...

  3. 使用Apache Ant合并多个jar

    Apache Ant下载地址 下载解压后进入bin目录,并在此目录打开cmd 在cmd中运行ant,运行结果为: Buildfile: build.xml does not exist! Build ...

  4. 【c++】map 迭代器删除演示样例

    C++ STL中的map是很常见的.通常我们用例如以下方式来遍历,而且删除map中的一些entry: map<int, int> mp; mp.insert(make_pair(1,1)) ...

  5. MyEclipse 8.5 启动过程优化

    前言:MyEclipse5.5 大小 139M:MyEclipse6.5 大小 451M:MyEclipse7.0 大小 649M:MyEclipse8.0 大小 772.3MB(速度方面比7.1和7 ...

  6. HDU3081 Marriage Match II —— 传递闭包 + 二分图最大匹配 or 传递闭包 + 二分 + 最大流

    题目链接:https://vjudge.net/problem/HDU-3081 Marriage Match II Time Limit: 2000/1000 MS (Java/Others)    ...

  7. POJ2195 Going Home —— 最大权匹配 or 最小费用最大流

    题目链接:https://vjudge.net/problem/POJ-2195 Going Home Time Limit: 1000MS   Memory Limit: 65536K Total ...

  8. HDU 2036:改革春风吹满地

    改革春风吹满地 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Su ...

  9. 织梦栏目页分页title加"第N页"

    以上就是调用栏目管理的SEO标题代码:{dede:field.seotitle /}的方法,这样充分体现列表页标题显示的效果,有利于搜索引擎的收录. 第二个问题就是这样列表页的标题都成了一个样子的了, ...

  10. Spring注解的(List&Map)特殊注入功能

    一.先看一个示例演示:spring注解的一个特殊的注入功能. 首先,是定义一个接口,3个实现类. public interface GreetService { public String sayHe ...