题意:给定两个数 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 (水题,数学)的更多相关文章

  1. CodeForces 682A Alyona and Numbers (水题)

    Alyona and Numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/A Description After fi ...

  2. Codeforces Round #358 (Div. 2) A. Alyona and Numbers 水题

    A. Alyona and Numbers 题目连接: http://www.codeforces.com/contest/682/problem/A Description After finish ...

  3. 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 ...

  4. codeforces 577B B. Modulo Sum(水题)

    题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. Codeforces Gym 100286G Giant Screen 水题

    Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...

  6. codeforces 659A A. Round House(水题)

    题目链接: A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树

    A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...

  8. codeforces 696A Lorenzo Von Matterhorn 水题

    这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...

  9. CodeForces 589I Lottery (暴力,水题)

    题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...

随机推荐

  1. 【BZOJ】1030: [JSOI2007]文本生成器(AC自动机+dp)

    题目 传送门:QWQ 传送到洛谷QWQ 分析 我一开始也不会做这题的,后来看了很多网上的题解,终于AC了.(我好菜啊) 主要参考:传送门QWQ 直接搞非常麻烦,反正我是不会做.于是考虑求反,即求有多少 ...

  2. C++模板类练习题

    题目说明: 编写一个程序,使用类模板对数组元素进行排序,倒置.查找和求和 具有对数组元素进行排序,倒置.查找和求和功能, 然后产生类型实参分别为int型和double型的两个模板类, 分别对整型数组与 ...

  3. Linux下编译、安装并启动apache

    安装步骤如下: 1.  首先去http://httpd.apache.org/download.cgi上下载需要的apache源码,然后存放至/usr/local/src下[此源码存放路径可任意指定] ...

  4. RHCE7 学习里程-4用户权限,简单进程管理

    #创建用户 useradd abc 使用 vipw 命令查看 /etc/passwd 文件下 是否存在新用户 #G却换到最后一行 #创建账号的时候,默认也新建了一个组,组名跟用户名一样 groupad ...

  5. Windows下安装kibana

    1. 下载ElasticSearch https://www.elastic.co/downloads/kibana https://www.elastic.co/downloads/past-rel ...

  6. 黑暗之光 Day1

    1. 设置鼠标指针图标 Build Setting -> Player Setting 2. 添加雾的效果 Window->Lighting->Settings. 3. 任意键按下事 ...

  7. @RestController使用 接收jso参数 将参数转换为对象

    package com.monitor.controller; import org.springframework.http.ResponseEntity; import org.springfra ...

  8. 使用NPM在项目中引入【lodash】

    mkdir [文件名 ] 创建项目文件 mkdir lodashDemo cd [文件名] 进入项目文件 cd lodashDemo nvm -v 查看nvm版本,确定nvm已安装 nvm -v No ...

  9. spring boot aop打印http请求回复日志包含请求体

    一.引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...

  10. AddComponentMenu

    [AddComponentMenu] The AddComponentMenu attribute allows you to place a script anywhere in the " ...