HDUOJ----Good Numbers
Good Numbers
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 673 Accepted Submission(s): 242
The answer maybe very large, we recommend you to use long long instead of int.
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define LL _int64
#include<algorithm>
using namespace std;
LL cal(LL n)
{
LL num,i,j,ans,sum;
num=n/100;
ans=num*10;
for(i=num*100;i<=n;i++)
{
j=i;
sum=0;
while(j)
{
sum+=j%10; //将各个位相加
j/=10;
}
if(sum%10==0)
ans++;
}
return ans;
}
void Init()
{
LL l,r;
static int count=1;
scanf("%I64d%I64d",&l,&r);
LL temp=cal(r)-cal(l-1);
printf("Case #%d: %I64d\n",count++,temp);
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
Init();
}
return 0;
}
HDUOJ----Good Numbers的更多相关文章
- hduoj 4706 Herding 2013 ACM/ICPC Asia Regional Online —— Warmup
hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup Herding Time Limit: 2000/1000 ...
- Java 位运算2-LeetCode 201 Bitwise AND of Numbers Range
在Java位运算总结-leetcode题目博文中总结了Java提供的按位运算操作符,今天又碰到LeetCode中一道按位操作的题目 Given a range [m, n] where 0 <= ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- [LeetCode] Add Two Numbers II 两个数字相加之二
You are given two linked lists representing two non-negative numbers. The most significant digit com ...
- [LeetCode] Maximum XOR of Two Numbers in an Array 数组中异或值最大的两个数字
Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum re ...
- [LeetCode] Count Numbers with Unique Digits 计算各位不相同的数字个数
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
- [LeetCode] Bitwise AND of Numbers Range 数字范围位相与
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers ...
- [LeetCode] Valid Phone Numbers 验证电话号码
Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bas ...
- [LeetCode] Consecutive Numbers 连续的数字
Write a SQL query to find all numbers that appear at least three times consecutively. +----+-----+ | ...
- [LeetCode] Compare Version Numbers 版本比较
Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 &l ...
随机推荐
- jsonConfig使用方法
1.先编写jsonConfig的初始化代码 private JsonConfig jsonConfig; public action构造方法() { jsonConfig = new JsonConf ...
- Android图片加载框架最全解析(六),探究Glide的自定义模块功能
不知不觉中,我们的Glide系列教程已经到了第六篇了,距离第一篇Glide的基本用法发布已经过去了半年的时间.在这半年中,我们通过用法讲解和源码分析配合学习的方式,将Glide的方方面面都研究了个遍, ...
- 【UOJ Round #8】
A 一道不错的题,虽然大家都觉得是水题,然而蒟蒻我想出来的好慢……Orz alpq 发现其实就是一个网格图,每一个大块都是同一颜色……横纵坐标互不干扰…… //UOJ Round #8 A #incl ...
- hbase数据模型以及编码压缩(转)
原文链接:hbase源码系列(四)数据模型-表定义和列族定义的具体含义 hbase是一个KeyValue型的数据库,在<hbase实战>描述它的逻辑模型[行键,列族,列限定符,时间版本], ...
- @Java中使用Jedis操作Redis之一
依赖的jar包:jedis <dependency> <groupId>redis.clients</groupId> <artifactId>jedi ...
- DB-library 常用函数
以下转自:http://blog.csdn.net/lwbeyond/article/details/5620801 1. Dbcmd和dbfcmd 函数原形: Dbcmd(DBPROCESS *pr ...
- JS 和 HTML 中的单引号与双引号
JS中的单引号与双引号 HTML中的单引号与双引号很简单,就是两个字符实体: 显示 描述 实体名称 实体编号 " 双引号.引号 " " ' 单引号.撇号 &apo ...
- Raphael path 拖动实现
让 Raphael 的 Path 动起来 Raphaël 是一个很实用的线上矢量图操作 Javascript 库.使用简单,一个值得一提的卖点是通过抽象出共同的接口屏蔽了 SVG 和 VML 之间的差 ...
- 【用jQuery来判断浏览器的类型】及【javascript获取用户ip地址】
用jQuery来判断浏览器的类型,主要是使用$.browser这个工具类,使用方法: $.browser.['浏览器关键字'] //谷歌浏览器.360浏览器等其他一些浏览器,没有专门的判断 funct ...
- Android -- 触摸Area对焦区域(更新)
老早就想找关于不同点击不同地方的对焦,但是一直没有找到,现在项目又需要这个功能,又跑出来找找,最后还是找到啦~~关于对焦更多的是关于自动对焦. 废话不多说,直接来干货,主要是setFocusAreas ...