博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
728. Self Dividing Numbers(数学)
阅读量:4180 次
发布时间:2019-05-26

本文共 442 字,大约阅读时间需要 1 分钟。

思路:遍历每一位,直接判断即可

代码

class Solution {public:    vector
selfDividingNumbers(int left, int right) { vector
result; for(int x=left;x<=right;x++){ int temp = x; while(temp){ if(temp%10==0||(x%(temp%10)!=0)){ break; } temp = temp / 10; } if(!temp) result.push_back(x); } return result; }};

转载地址:http://hjrai.baihongyu.com/

你可能感兴趣的文章
628. Maximum Product of Three Numbers(排序)
查看>>
Linux内核-------同步机制(二)
查看>>
面试题31-------连续子数组的最大和(数组)
查看>>
epoll 实现Chat
查看>>
21. Merge Two Sorted Lists(链表)
查看>>
2. Add Two Numbers(链表)
查看>>
637. Average of Levels in Binary Tree(Tree)
查看>>
226. Invert Binary Tree(Tree)
查看>>
328. Odd Even Linked List(链表)
查看>>
199. Binary Tree Right Side View(Tree)
查看>>
230. Kth Smallest Element in a BST(Tree)
查看>>
求字符串的最长回文串-----Manacher's Algorithm 马拉车算法
查看>>
回溯法常用的解题模板和常见题型
查看>>
深入分析Java I/O 的工作机制
查看>>
动态规划的套路----左神
查看>>
KMP算法简解
查看>>
左神算法课进阶版总结
查看>>
左神算法基础班总结
查看>>
Linux性能优化
查看>>
进程间的通信---UNIX高级环境编程
查看>>