1、题目描述

2、代码

 int rotatedDigits(int N) {
int res = ; for (int i = ; i <= N; i++) {
if (isGood(i)) {
res++;
}
} return res;
} bool isGood(int x)
{
int rx = x;
vector<int> nums;
while (x) {
int r = x % ;
nums.push_back(r);
x = x / ;
} for (vector<int>::iterator it = nums.begin(); it != nums.end(); it++ ) {
if (*it == || *it == || *it == )
return false;
if (*it == || *it == || *it == )
continue; if (*it == ) {
*it = ;
continue;
} if (*it == ) {
*it = ;
continue;
} if (*it == ) {
*it = ;
continue;
} if (*it == ) {
*it = ;
continue;
}
} int good = ;
for (vector<int>::reverse_iterator ite = nums.rbegin(); ite != nums.rend(); ite++) {
good = good * + *ite;
} return good != rx;
}

LeetCode题解之Rotated Digits的更多相关文章

  1. LeetCode算法题-Rotated Digits(Java实现)

    这是悦乐书的第316次更新,第337篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第185题(顺位题号是788).如果一个数字经过180度旋转后,变成了一个与原数字不同的 ...

  2. 【LeetCode】788. Rotated Digits 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

  3. LeetCode 题解之Add Digits

    1.问题描述 2.问题分析 循环拆分数字,然求和判断. 3.代码 int addDigits(int num) { ) return num; int result = num; do{ vector ...

  4. 73th LeetCode Weekly Contest Rotated Digits

    X is a good number if after rotating each digit individually by 180 degrees, we get a valid number t ...

  5. [LeetCode 题解] Search in Rotated Sorted Array

    前言 [LeetCode 题解]系列传送门: http://www.cnblogs.com/double-win/category/573499.html 题目描述 Suppose an array ...

  6. LeetCode 788. 旋转数字(Rotated Digits) 36

    788. 旋转数字 788. Rotated Digits 题目描述 我们称一个数 X 为好数, 如果它的每位数字逐个地被旋转 180 度后,我们仍可以得到一个有效的,且和 X 不同的数.要求每位数字 ...

  7. [LeetCode 题解]:Palindrome Number

    前言   [LeetCode 题解]系列传送门:  http://www.cnblogs.com/double-win/category/573499.html   1.题目描述 Determine ...

  8. [LeetCode 题解]:Intersection of Two Linked Lists

    前言   [LeetCode 题解]系列传送门:  http://www.cnblogs.com/double-win/category/573499.html   1.题目描述 Suppose an ...

  9. [LeetCode 题解]: plusOne

    前言   [LeetCode 题解]系列传送门:  http://www.cnblogs.com/double-win/category/573499.html   1.题目描述 Given a no ...

随机推荐

  1. 【原创】基于Bootstrap的Modal二次封装

    前言 Bootstrap:Twitter推出的一个开源的用于前端开发的工具包.它由Twitter的设计师Mark Otto和Jacob Thornton合作开发,是一个CSS/HTML框架 官方网站: ...

  2. 22-hadoop-hive搭建

    1, hive简介 hive是基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张数据库表,并提供简单的sql查询功能,可以将sql语句转换为MapReduce任务进行运行. 其优点是 ...

  3. log4jdbc 与 logback 集合打印日志过多的解决

    在项目中使用了log4jdbc,可以很方便的把sql的参数也打印出来,便于问题调试.比如原始sql: select * from t_order where order_id = ? : 经过log4 ...

  4. Android so文件进阶 <一>

    0x00  前言   最近一段时间在弄android方面的东西,今天有人发了张截图,问:在要dump多大的内存? 一时之间我竟然想不起来ELF文件的哪个字段表示的是文件大小,虽然最后给出了解决方法,I ...

  5. 第一次项目上Linux服务器(一:远程连接服务器)

    一.准备工作 1.Linux服务器一台,以及服务器ip.用户名.密码 2.安装xfttp和xshell软件,资源链接,百度云链接:https://pan.baidu.com/s/1vwnlbBpmjX ...

  6. 使用Visual Studio 调试断点不起作用的问题解决办法 调试Revit CAD 不能进入断点

    随着Visual Studio 2010正式版的发布,相信不少人都像我一样升级到了Visual Studio 2010.那么您在使用VS2010在AutoCAD,Map 3D或Revit的.net应用 ...

  7. Spring Security基本配置

    Spring Security 是一个功能强大且可高度自定义的身份验证和访问控制框架. 它是保护基于Spring的应用程序的事实上的标准.Spring Security 是一个专注于为Java应用程序 ...

  8. 啰里吧嗦CountDownLatch

    java.util.concurrent Class CountDownLatch 目录 CountDownLatch 是什么 CountDownLatch是一个同步工具类,它允许一个或多个线程一直等 ...

  9. swagger2的使用

    springboot项目里怎么使用swagger2? 1.maven依赖 <dependency> <groupId>io.springfox</groupId> ...

  10. spring 注解@PathVariable

    @PostMapping(name="获取用户信息", value="/getUser/{userId}") public Object getUser(@Pa ...