leetcode_357. Count Numbers with Unique Digits
https://leetcode.com/problems/count-numbers-with-unique-digits/
给定一个n,计算[0,10^n]中十进制中每一位都不相同的数的数目。
class Solution{
public:
int countNumbersWithUniqueDigits(int n){
int res=;
int wei = min(, n);
for(int i=wei; i>; i--){
int tmp = ;
for(int j=i-; j>; j--)
tmp *= -i+j+;
res+=tmp;
}
return res+;
}
};
leetcode_357. Count Numbers with Unique Digits的更多相关文章
- LC 357. Count Numbers with Unique Digits
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
- [LeetCode] Count Numbers with Unique Digits 计算各位不相同的数字个数
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
- Count Numbers with Unique Digits
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
- Leetcode: Count Numbers with Unique Digits
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
- 357. Count Numbers with Unique Digits
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
- 【Leetcode】357. Count Numbers with Unique Digits
题目描述: Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. ...
- [Swift]LeetCode357. 计算各个位数不同的数字个数 | Count Numbers with Unique Digits
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
- Java [Leetcode 357]Count Numbers with Unique Digits
题目描述: Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. ...
- Count Numbers with Unique Digits -- LeetCode
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10^n. Exam ...
随机推荐
- android编程取消标题栏方法(appcompat_v7、Theme.NoTitleBar)
方式一:编码方式 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstance ...
- BZOJ_3476_[Usaco2014 Mar]The Lazy Cow_扫描线+切比雪夫距离
BZOJ_3476_[Usaco2014 Mar]The Lazy Cow_扫描线+切比雪夫距离 Description It's a hot summer day, and Bessie the c ...
- Ordeby then by
先按orderby排序,再按thenby排序 return PartialView("_ClickRangeOnCategory", articles.OrderByDescend ...
- 安装phpwind报错
在安装phpwind时,下面的报错提示是什么原因呢? 答:数据库密码应设置为空
- strcpy(转载)
转自:http://www.kuqin.com/clib/string/strcpy.html 原型:extern char *strcpy(char *dest,char *src); 用法:#in ...
- bzoj 3503: [Cqoi2014]和谐矩阵【高斯消元】
如果确定了第一行,那么可以推出来整个矩阵,矩阵合法的条件是n+1行全是0 所以推出来n+1行和1行的关系,然后用异或高斯消元来解即可 #include<iostream> #include ...
- LuoguP1948 电话线 【二分答案/图论】
其实是和奥格瑞玛一样的题啦. 但还是想了很久后看了题解. 多年以后,笨笨长大了,成为了电话线布置师.由于地震使得某市的电话线全部损坏,笨笨是负责接到震中市的负责人.该市周围分布着N(1<=N&l ...
- ppt自动制作器
讲一篇论文导入进入,自动生成该论文的展示ppt,啧啧啧,想想岂不是很美妙
- MYSQL 配置远程连接
例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话. GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY ...
- 进击的Python【第十一章】:消息队列介绍、RabbitMQ&Redis的重点介绍与简单应用
消息队列介绍.RabbitMQ.Redis 一.什么是消息队列 这个概念我们百度Google能查到一大堆文章,所以我就通俗的讲下消息队列的基本思路. 还记得原来写过Queue的文章,不管是线程queu ...