[ACM_水题] 不要62(hdu oj 2089, 不含62和4的数字统计)
杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。
不吉利的数字为所有含有4或62的号码。例如:
62315 73418 88914
都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以不属于不吉利数字之列。
你的任务是,对于每次给出的一个牌照区间号,推断出交管局今次又要实际上给多少辆新的士车上牌照了。
0 0
解题思路:直接暴力计算(网上还有个用dp的可参考:http://blog.csdn.net/linraise/article/details/12282901)
#include<iostream>
#include<string.h>
using namespace std;
int sum[];
bool ok(int n){
while(n){
if(n%==||n%==)return ;
n=n/;
}
return ;
}
int main(){
memset(sum,,sizeof(sum));
for(int i=;i<;i++){
sum[i]=sum[i-]+ok(i);
}
int n,m;
while(cin>>n>>m){
if(m==n && m==)break;
cout<<sum[m]-sum[n]+ok(n)<<'\n';
}return ;
}
[ACM_水题] 不要62(hdu oj 2089, 不含62和4的数字统计)的更多相关文章
- ACM_水题你要信了(修改版)
水题你要信了 Time Limit: 2000/1000ms (Java/Others) Problem Description: 某发最近又认识了很多妹(han)子,可是妹(han)子一多不免有时会 ...
- [ACM_水题] UVA 12502 Three Families [2人干3人的活后分钱,水]
Three Families Three families share a garden. They usually clean the garden together at the end o ...
- ACM_水题你信吗
水题你信吗 Time Limit: 2000/1000ms (Java/Others) Problem Description: 某发最近又认识了很多妹(han)子,可是妹(han)子一多不免有时会忘 ...
- [ACM_水题] Yet Another Story of Rock-paper-scissors [超水 剪刀石头布]
Description Akihisa and Hideyoshi were lovers. They were sentenced to death by the FFF Inquisition. ...
- [ACM_水题] UVA 11729 Commando War [不可同时交代任务 可同时执行 最短完成全部时间 贪心]
There is a war and it doesn't look very promising for your country. Now it's time to act. You have a ...
- [ACM_水题] UVA 11292 Dragon of Loowater [勇士斗恶龙 双数组排序 贪心]
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shor ...
- [ACM_水题] ZOJ 3706 [Break Standard Weight 砝码拆分,可称质量种类,暴力]
The balance was the first mass measuring instrument invented. In its traditional form, it consists o ...
- [ACM_水题] ZOJ 3714 [Java Beans 环中连续m个数最大值]
There are N little kids sitting in a circle, each of them are carrying some java beans in their hand ...
- [ACM_水题] ZOJ 3712 [Hard to Play 300 100 50 最大最小]
MightyHorse is playing a music game called osu!. After playing for several months, MightyHorse disco ...
随机推荐
- CSS BOX模型
对于box模型概念的理解以及它与决定元素最终尺寸的方式有何关系,是理解如何设定网 页上的元素位置的基础.box模型应用到块级元素.一个随之而来的概念,内联布局模型 定义了如何设定内联元素的位置. 对于 ...
- localstorage,sessionstorage使用
今天看了一下HTML5,也算是简单的学习一下吧,HTML5 提供了两种在客户端存储数据的新方法:localstorage,sessionstorage. localStorage - 没有时间限制的数 ...
- z-tree
1 获取所有的节点集合 var nodes = treeObj.getNodes();//只获取根节点 var nodesAll = treeObj.transformToArray(nodes);/ ...
- asp.net GDI+绘制矩形渐变
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- Android菜鸟成长记2-内部类
Java内部类 内部类是指在一个外部类的内部再定义一个类.类名不需要和文件夹相同. 内部类可以是静态static的,也可用public,default,protected和private修 ...
- http://10.11.112.12:8000/homePage.jsp?loginMode=JS
sdsad http://svn.paic.com.cn/svn/mis_pac/branches/MIS-PAC5.22.0
- java1.7集合源码阅读: Vector
Vector是List接口的另一实现,有非常长的历史了,从jdk1.0开始就有Vector了,先于ArrayList出现,与ArrayList的最大区别是:Vector 是线程安全的,简单浏览一下Ve ...
- HTTP-崔希凡笔记
HTTP协议(重点) 协议:协议的甲乙双方,就是客户端(浏览器)和服务器! 理解成双方通信的格式! l 请求协议: l 响应协议: 1 安装HttpWatch HttpWatch是专门为IE浏览器 ...
- Scrum会议10.19
Scrum会议 组名称:好好学习 项目名称:记账本 参会成员:林莉(Master)胡丽娜 宫丽君 汪东涵 时间:2016.10.19 已完成内容: 1.完成新项目的查找,查找学姐的代码和项目. 2.理 ...
- unity3d使用脚本保存屏幕截图
using UnityEngine; using System.Collections; using System.IO; public class FrameAnimation : MonoBeha ...