Educational Codeforces Round 6 B. Grandfather Dovlet’s calculator 暴力
Once Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with seven-segment indicators (https://en.wikipedia.org/wiki/Seven-segment_display).

Max starts to type all the values from a to b. After typing each number Max resets the calculator. Find the total number of segments printed on the calculator.
For example if a = 1 and b = 3 then at first the calculator will print 2 segments, then — 5 segments and at last it will print 5 segments. So the total number of printed segments is 12.
The only line contains two integers a, b (1 ≤ a ≤ b ≤ 106) — the first and the last number typed by Max.
Print the only integer a — the total number of printed segments.
1 3
12
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = ;
ll H[N][],a,b;
int M[] = {,,,,,,,,,};
int main() {
for(int i = ; i <= ; i++) {
int tmp = i;
while(tmp) H[i][tmp%]++,tmp/=;
}
ll ans = ;
scanf("%I64d%I64d",&a,&b);
for(int i = a; i <= b; i++) {
for(int j = ; j <= ; j ++) ans+= M[j] * H[i][j];
}
printf("%I64d\n",ans);
return ;
}
Educational Codeforces Round 6 B. Grandfather Dovlet’s calculator 暴力的更多相关文章
- Educational Codeforces Round 4 B. HDD is Outdated Technology 暴力
B. HDD is Outdated Technology 题目连接: http://www.codeforces.com/contest/612/problem/B Description HDD ...
- Educational Codeforces Round 1 B. Queries on a String 暴力
B. Queries on a String Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/59 ...
- Educational Codeforces Round 24 A 水 B stl C 暴力 D stl模拟 E 二分
A. Diplomas and Certificates time limit per test 1 second memory limit per test 256 megabytes input ...
- Educational Codeforces Round 22 B. The Golden Age(暴力)
题目链接:http://codeforces.com/contest/813/problem/B 题意:就是有一个数叫做不幸运数,满足题目的 n = x^a + y^b,现在给你一个区间[l,r],让 ...
- Educational Codeforces Round 15 A, B , C 暴力 , map , 二分
A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input standard ...
- [Educational Codeforces Round 16]E. Generate a String
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...
- [Educational Codeforces Round 16]D. Two Arithmetic Progressions
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...
- [Educational Codeforces Round 16]C. Magic Odd Square
[Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...
- [Educational Codeforces Round 16]B. Optimal Point on a Line
[Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...
随机推荐
- 2014秋C++ 第7周项目 数据类型和表达式
课程主页在http://blog.csdn.net/sxhelijian/article/details/39152703,课程资源在云学堂"贺老师课堂"同步展示,使用的帐号请到课 ...
- Oracle 中UNDO与REDO的差别具体解释
一 为了更清楚的看出2者差别,请看下表: UNDO ...
- 【opencv】opencv在vs下的配置(持续更新)
经常使用配置记录,会更新下去. 1.去掉ipch及.sdf文件 opencv在vs编译会得到很多文件.当中.dsf和ipch文件就有几十M.总是非常占空间,而这都是用来保存C++预编译的头文件和Int ...
- crawler4j图片爬虫
该实例主要演示下如何爬取指定网站的图片: 代码中有详细注释: 首先写一个ImageCrawler类: package com.demo.imageCrawler4j; import java.io.F ...
- web工程中的各种路径(eclipse开发)
目前遇到的 web 工程中要写url和路径的文件有 webContent中.jsp/.html :action src中的servlet类 : 映射地址.重定向.请求转发.访问资源文件(webCont ...
- Spring meven 配置
使用maven的仓库化管理,可以更方便有效的控制文件. 在官网下载maven. 官网的地址:http://maven.apache.org/download.cgi 请选择最新的版本下载, 这里我用 ...
- URL回车后发生了什么
1.解析URL ________________________________________________________________________ 关于URL: URL(Universa ...
- selenium基础
浏览器 selenium本质是通过驱动浏览器,完全模拟浏览器的操作,比如跳转.输入.点击.下拉等来拿到网页渲染之后的结果,可支持多种浏览器 官网链接:http://selenium-python.re ...
- css3背景渐变以及图片混合渲染模式(二)
http://avnpc.com/pages/photoshop-layer-blending-algorithm http://www.html5cn.org/forum.php?mod=viewt ...
- Python的流程控制
条件判断 通过`if`,`elif`,`else`关键字来实现条件判断逻辑的实现,执行改结构中的其中一个,其结构如下: if condition1: pass elif condition2: pas ...