当前位置:网站首页>【入门】提取不重复的整数
【入门】提取不重复的整数
2022-07-01 07:55:00 【-天道酬勤-】
描述
输入一个 int 型整数,按照从右向左的阅读顺序,返回一个不含重复数字的新的整数。保证输入的整数最后一位不是 0 。
输入描述
输入一个int型整数
输出描述
按照从右向左的阅读顺序,返回一个不含重复数字的新的整数
示例1
输入:9876673
输出:37689
<?php
fscanf(STDIN, "%d", $a);
// 转为字符串
$a .= "";
// 结果字符串
$res = '';
// 字符串长度
$len = strlen($a);
for ($i = $len - 1; $i > -1; $i--) {
if (strpos($res, $a[$i]) !== false) {
continue;
}
$res .= $a[$i];
}
echo $res;

边栏推荐
- 浅谈CVPR2022的几个研究热点
- Cyclic neural network
- 论文学习——水文时间序列相似性查询的分析与研究
- Conscience Amway universal wheel SolidWorks model material website
- Introduction to kubernetes resource objects and common commands (II)
- The triode is a great invention
- PostgreSQL source code learning (26) -- windows vscode remote debugging PostgreSQL on Linux
- Kickback -- find the first palindrome character in a group of characters
- Redisson uses the complete solution - redisson official documents + Notes (Part 1)
- Vhost kick & call principle
猜你喜欢

Latex table

Significance and measures of source code encryption

The triode is a great invention

postgresql源码学习(26)—— Windows vscode远程调试Linux上的postgresql

2022 test questions and mock examinations for main principals of hazardous chemicals business units

2022 operation of refrigeration and air conditioning equipment operation of national question bank simulated examination platform

SharePoint - modify web application authentication using PowerShell

图扑软件通过 CMMI5 级认证!| 国际软件领域高权威高等级认证

Latex formula code

Wang Yingqi, founder of ones, talks to fortune (Chinese version): is there any excellent software in China?
随机推荐
[MySQL learning notes 26] view
Todolist classic case ①
浏览器本地存储
2022危险化学品经营单位主要负责人试题及模拟考试
How do the top ten securities firms open accounts? In addition, is it safe to open a mobile account?
Implementation and encapsulation of go universal dynamic retry mechanism
漏刻有时API接口实战开发系列(14):身份证实名鉴权验证
Custom events of components ①
How relational databases work
[R language] two /n data merge functions
Aardio - 自己构造的getIconHandle的方法
Gui Gui programming (XV) - use scale to control font size changes
Redisson uses the full solution - redisson official document + comments (Part 2)
How to get a SharePoint online site created using the office365 group template
【R语言】年龄性别频数匹配 挑选样本 病例对照研究,对年龄性别进行频数匹配
redisson看门狗机制,redisson看门狗性能问题,redisson源码解析
[MySQL learning notes 25] SQL statement optimization
良心安利万向轮 SolidWorks模型素材网站
The database is locked. Is there a solution
ContentType所有类型对比