Codeforces 764A-Taymyr is calling you
来源:互联网 发布:西安 人工智能 编辑:程序博客网 时间:2024/06/07 02:16
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 ≤ 104).
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 10
10
1 2 5
2
2 3 9
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.
题意:给出a,b,问区间1~L上有多少个ab的公倍数
#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <algorithm>#include <cmath>#include <queue>#include <vector>#include <set>#include <stack>#include <map>#include <climits>using namespace std;#define LL long longconst int INF=0x3f3f3f3f;int gcd(int x,int y){ if(x>y) return gcd(y,x); while(y%x) { int k=y%x; y=x; x=k; } return x;}int main(){ int n,m,z; while(~scanf("%d %d %d",&n,&m,&z)) { int k=n*m/gcd(n,m); printf("%d\n",z/k); } return 0;}
- 【codeforces 764A】Taymyr is calling you
- Codeforces 764A-Taymyr is calling you
- Codeforces 764 A Taymyr is calling you
- CodeForces 764A Taymyr is calling you
- codeforces 764A Taymyr is calling you
- A. Taymyr is calling you
- A - Taymyr is calling you
- A Taymyr is calling you--Codeforces Round #395 (Div. 2)
- 【Codeforces Round #395 (Div. 2)】Codeforces 764A Taymyr is calling you
- Codeforces 764A Taymyr is calling you(水题翻译)
- Codeforces Round #395 (Div. 2) A. Taymyr is calling you(水题)
- Codeforces Round #395(Div. 2)A. Taymyr is calling you【水题】
- Codeforces Round #395 (Div. 2)Taymyr is calling you
- CF764 A. Taymyr is calling you(水题)
- TypeError: $ is not a function when calling jQuery function
- You're Given a String... CodeForces
- you are calling a UIKit method that can only be invoked from the UI thread.
- This result is a forward only result set, calling rewind() after moving forward is not supported
- 快速排序算法思路笔记
- 关于端口(port)的一点理解
- ZJOI 2010 贪吃的老鼠 最大流
- 第14天(就业班) 自定义标签&mvc编码实战
- qt 下log4cplus的使用
- Codeforces 764A-Taymyr is calling you
- 数值填空题
- 开源OSS.Social微信项目进阶介绍
- 【密码学】一万字带您走进密码学的世界(下)
- flume1.7源码编译及main方法启动
- 开源OSS.Social微信项目解析
- Objective-C中使用extern引用外部全局变量(如:创建全局可变字符串)
- Codeforces 764B-Timofey and cubes
- leecode 解题总结:29 Divide Two Integers