Codeforces Round #395 (Div. 2) A. Taymyr is calling you【数论/最小公倍数】
1 second
256 megabytes
standard input
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.
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.
【题意】:某人每间隔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【数论/最小公倍数】的更多相关文章
- 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 ...
- Codeforces Round #395 (Div. 2)(未完)
2.2.2017 9:35~11:35 A - Taymyr is calling you 直接模拟 #include <iostream> #include <cstdio> ...
- Codeforces Round #395 (Div. 2)
今天自己模拟了一套题,只写出两道来,第三道时间到了过了几分钟才写出来,啊,太菜了. A. Taymyr is calling you 水题,问你在z范围内 两个序列 n,2*n,3*n...... ...
- 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 ...
- 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 ...
- 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 ...
- Codeforces Round #395 (Div. 2) A
Description Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls f ...
- Codeforces Round #395 (Div. 1)
比赛链接:http://codeforces.com/contest/763 A题: #include <iostream> #include <cstdio> #includ ...
- 【分类讨论】Codeforces Round #395 (Div. 2) D. Timofey and rectangles
D题: 题目思路:给你n个不想交的矩形并别边长为奇数(很有用)问你可以可以只用四种颜色给n个矩形染色使得相接触的 矩形的颜色不相同,我们首先考虑可不可能,我们分析下最多有几个矩形互相接触,两个时可以都 ...
随机推荐
- 跟我一起在Win10中用VMware安装Ubuntu
VMware下安装Ubuntu 打开VMware,创建虚拟机: 点击运行虚拟机,报错为 解决办法为 大功告成,我们已经在Win10中用VMware安装Ubuntu了
- [转]WPF中Binding的技巧
在WPF应用的开发过程中Binding是一个非常重要的部分. 在实际开发过程中Binding的不同种写法达到的效果相同但事实是存在很大区别的. 这里将实际中碰到过的问题做下汇总记录和理解. 1. so ...
- Gym - 102021E
Gym - 102021Ehttps://vjudge.net/problem/2109787/origin主要是一个处理精度的技巧,避免精度误差可以加eps,然后乘1e(小数点之后的位数). #in ...
- Java发送http请求发送json对象
直接上代码: http工具类: public static String httpPostWithjson(String url, String json) throws IOException { ...
- SSH协议的Python实现paramiko
目录 paramiko安装 SSHClient类与SFTPClient类 SSHClient类的方法 SFTPClient类的方法 paramiko的基本使用 paramiko.SSHClient两种 ...
- Django项目:CRM(客户关系管理系统)--78--68PerfectCRM实现CRM业务流程(bpm)报名缴费分页
# pagination.py # ————————68PerfectCRM实现CRM业务流程(bpm)报名缴费分页———————— from django.utils.safestring impo ...
- leyou_02_nginx使用域名访问本地项目
1.nginx的搭建依赖环境 1.1 准备jdk环境 当前最新版本下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index. ...
- Linux 定时任务执行 php artisan
*/ * * * * php /www/wwwroot/project/artisan command:exec postNews 5分钟执行一次
- cmd命令调用powershell脚本方法
cmd方法: powershell -command ". ('ps1脚本路径'); WriteInfo -param 'param参数值'" ps1脚本代码: function ...
- linux和window双系统下修改系统启动项
参考:http://jingyan.baidu.com/article/63acb44ae4062c61fcc17e27.html: 我们在安装双系统之后经常会遇到想打开windows但默认启动项是u ...