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个矩形染色使得相接触的 矩形的颜色不相同,我们首先考虑可不可能,我们分析下最多有几个矩形互相接触,两个时可以都 ...
随机推荐
- history配置
/etc/profile配置文件中,末尾增加如下参数项: HFILE=`who -m | awk '{print $1}'`readonly HISTFILE=/var/history/$HFILE- ...
- leetcode 854. K-Similar Strings
给定两个字符串, 判断最少经过多少次swap 可以使得 两个字符串一致, 首先类似的问题 是存在一个 underlying graph 的. 每一个字母都对应着一个节点,两个字符串的不一致表示为图上的 ...
- MySQL模拟Oracle序列使用
https://www.runoob.com/mysql/mysql-using-sequences.html 一篇笔记开始看 注意:创建序列表时一定要有 主键id自增,否则为只读状态不能修改递增 ...
- Linux常用技巧
1.解决不能中文显示 xshell 终端语言显示选择UTF-8 #yum groupinstall chinese-support 2.heredocument报错“unexpected end of ...
- spark dataframe 将null 改为 nan
由于我要叠加rdd某列的数据,如果加数中出现nan,结果也需要是nan,nan可以做到,但我要处理的数据源中的nan是以null的形式出现的,null不能叠加,而且我也不能删掉含null的行,于是我用 ...
- Java 普通代码块,构造代码块,静态代码块
具体百度... 这里只记下,构造构造代码块在构造函数之前执行,每创建一个对象则执行一次. 静态代码块属于类,而不是对象,只执行一次.
- 装配SpringBean(四)--注解装配之组件扫描
前两篇文章我总结了通过XML方式装配bean的实现方式,虽然比较简单,但是需要配置很多,很多时候我们都会使用注解进行装配.使用注解的方式可以减少XML的配置,既能实现XML的功能,还提供了自动装配功能 ...
- 爬虫(三)通过Selenium + Headless Chrome爬取动态网页
一.Selenium Selenium是一个用于Web应用程序测试的工具,它可以在各种浏览器中运行,包括Chrome,Safari,Firefox 等主流界面式浏览器. 我们可以直接用pip inst ...
- CImage 是基于GDI+的,很老的一篇文章,我很久很久以前看到过的
在许多资料上都说CImage类是基于GDI+的,但是为什么是基于GDI+的呢? 因为使用这个类时,并没有加入#include <gdiplus.h> ,也没有在程序开始和结束时分别写GDI ...
- 使用 windows 批处理指令(BAT文件)进行文件删除、复制操作
以下是做文件删除和复制的批处理指令 ::替换文件需要添加 /y 参数才能直接替换.不然会出现提示是否替换. ::复制Axis2Implementation和WebServices编译后的文件到tomc ...