codeforces 340 A. The Wall
来源:互联网 发布:java math.random 编辑:程序博客网 时间:2024/05/19 15:18
水水的一道题,只需要找xy的最小公倍数,然后找a b区间有多少个可以被xy的最小公倍数整除的数,就是答案。
//============================================================================// Name : 2013083101.cpp// Author : xindoo// Version :// Copyright : Your copyright notice// Description : codeforces 340A//============================================================================#include <iostream>#include <stdio.h>using namespace std;int gcd (int a, int b) {if (a % b == 0)return b;elsereturn gcd(b, a%b);}int main() {int x, y, a, b;while (scanf("%d %d %d %d", &x, &y, &a, &b) != EOF) {int t = x*y/gcd(x, y);int ans = b/t - a/t;if (a%t == 0)ans++;cout << ans << endl;}return 0;}
- codeforces 340 A. The Wall
- CodeForces 340A The Wall
- Codeforces-340A-The Wall
- Codeforces Round #198 (Div. 2) / 340A The Wall (数论)
- CF 340A The Wall
- codeforces The Wall - 题解
- Painting The Wall CodeForces
- Codeforces Round #198 (Div. 2) A. The Wall
- Codeforces Round #198(Div. 2)A. The Wall
- A. The Wall
- Codeforces 398B Painting The Wall(dp)
- Codeforces 690D2 The Wall (medium)
- CF DIV.2 A. The Wall
- CodeForces 398B Painting The Wall 概率DP
- codeforces 398B Painting The Wall (概率dp)
- !codeforces 399D Painting The Wall-概率dp
- codeforces Helvetic Coding Contest 2016 D2 The Wall (medium)
- 做一只墙上的苍蝇(a fly on the wall)
- js 根据模板增加表格(table)
- ubuntu下搭建ftp服务器vsftpd,cuteFTP登录该服务器
- Three Swaps DFS
- Objective-C中防止重复代码的一种方法
- Java中继承thread类与实现Runnable接口的区别
- codeforces 340 A. The Wall
- linux下如何添加一个用户并且让用户获得root权限
- jQuery之使用jQuery.fn.prop()替换jQuery.fn.attr()
- Book of Evil 树双向DFS
- 设置picturebox 背景为透明
- u- boot 的认识
- Google Protocol Buffer 的使用和原理
- 如何在ArcGIS Viewer for Silverlight中使用WCF服务完成降雨量专题图显示(二)
- MSM--Memcached_Session_Manager介绍及使用