CodeForces 682A Alyona and Numbers (水题,数学)
题意:给定两个数 m,n,问你在从1到 n,和从 1到 m中任选两个数加起来是5的倍数,问你有多少个。
析:先计算 m 和 n中有多少个取模5是从0到4的,然后根据排列组合,相乘就得到了小于等于 m 和 n的并且能整除五的个数,然后再加上剩下的。
代码如下:
#include <bits/stdc++.h> using namespace std;
typedef long long LL;
const int aa = 1234567;
const int bb = 123456;
const int cc = 1234; int main(){
int n, m;
while(cin >> n >> m){
int x = n / 5, y = m / 5;
int xx = n % 5, yy = m % 5;
LL ans = (LL)x * (LL)y * 5;
ans += xx * y + yy * x;
if(xx + yy >= 5) ans += (xx + yy) / 5 + (xx + yy) % 5;
cout << ans << endl;
}
return 0;
}
CodeForces 682A Alyona and Numbers (水题,数学)的更多相关文章
- CodeForces 682A Alyona and Numbers (水题)
Alyona and Numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/A Description After fi ...
- Codeforces Round #358 (Div. 2) A. Alyona and Numbers 水题
A. Alyona and Numbers 题目连接: http://www.codeforces.com/contest/682/problem/A Description After finish ...
- VK Cup 2016 - Qualification Round 2 A. Home Numbers 水题
A. Home Numbers 题目连接: http://www.codeforces.com/contest/638/problem/A Description The main street of ...
- codeforces 577B B. Modulo Sum(水题)
题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Gym 100286G Giant Screen 水题
Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...
- codeforces 659A A. Round House(水题)
题目链接: A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树
A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...
- codeforces 696A Lorenzo Von Matterhorn 水题
这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...
- CodeForces 589I Lottery (暴力,水题)
题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...
随机推荐
- ALSA声卡笔记4-----体验声卡
1 .配置内核支持UDA1341 (1)内核 解压内核并打上补丁 配置内核 platform 需要设置哪些配置项,先看一下platform,需要把S3c24xx-i2s.c文件配置上去,dma.c也要 ...
- eclipse安装使用注意点
1.eclipse tomcat集成找不到server http://blog.csdn.net/wugangsunny/article/details/25246565 2.Eclipse java ...
- git commit时候出现的问题
git commit 提交的时候,出现*** Please tell me who you are. git config --global ...问题 1 $ git commit -a -m 'v ...
- Sping实战之通过JAVA代码装配Bean
尽管在很多场景下通过组件扫描和自动装配实现Spring的自动化配置是更为推荐的方式,但有时候自动化配置的方案行不通,因此需要明确配置Spring.比如说,你想要将第三方库中的组件装配到你的应用中,在这 ...
- OpenLayers 3 之 地图控件(control)
OpenLayers 3 之 地图控件(control) 地图控件(control)是指地图上比例尺,缩略图,拉近拉远的按钮,滚动控制条等控件,默认控件有三个,可以禁用. OpenLayers 3 之 ...
- Embarcadero RAD Studio 2016 Product Approach and Roadmap
delphi 2016 路线图 http://community.embarcadero.com/article/news/16211-embarcadero-rad-studio-2016-pro ...
- bootstrap 自定义
在ror工程内 /app/assets/stylesheets/bootstrap_and_overrides.css.less 内覆盖内容 具体参数如下 https://github.com/twb ...
- Linux 下VI文件乱码解决
linux在vi 模式查看文件会有乱码问题 如图: 怎么解决呢? 在vi中输入冒号 然后执行下面的命令 如果系统编码不是utf8,vi看uft8编码文件时这样用:set termencoding=ut ...
- Django一些技巧
整数限制范围 from django.core.validators import MaxValueValidator, MinValueValidator start = models.Intege ...
- 软件工程第二次作业(Android Studio利用Junit进行单元测试)
一.开发工具的安装和运行 1.安装 由于我的电脑之前就安装好了Android Studio,就不再重装了.在这里就给出几条安装过程中需要注意的地方吧: 安装包最好在官网下载已经带有Android SD ...