当前位置:网站首页>【入门】提取不重复的整数
【入门】提取不重复的整数
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;

边栏推荐
- 2022 test questions and mock examinations for main principals of hazardous chemicals business units
- [MySQL learning notes27] stored procedure
- Source code analysis of open source API gateway APIs IX
- [R language] age sex frequency matching select samples for case-control study, and perform frequency matching on age and sex
- 【技能】创建.bat快速打开网页
- postgresql源码学习(26)—— Windows vscode远程调试Linux上的postgresql
- 2022 operation of refrigeration and air conditioning equipment operation of national question bank simulated examination platform
- 十大劵商如何开户?另外,手机开户安全么?
- 软件测试方法和技术 - 基础知识概括
- redisson使用全解——redisson官方文档+注释(下篇)
猜你喜欢
随机推荐
redisson看门狗机制,redisson看门狗性能问题,redisson源码解析
PWN attack and defense world int_ overflow
[website architecture] solve 90% of distributed transactions in one move, and introduce the working principles and application scenarios of database transactions and distributed transactions
Implementation and encapsulation of go universal dynamic retry mechanism
Rk3399 platform development series explanation (network debugging) 7.30. What will affect the sending process of TCP packets?
Redisson uses the complete solution - redisson official documents + Notes (Part 1)
Microsoft stream - how to modify video subtitles
SharePoint - modify web application authentication using PowerShell
Discussion on several research hotspots of cvpr2022
她就是那个「别人家的HR」|ONES 人物
2022 operation of refrigeration and air conditioning equipment operation of national question bank simulated examination platform
Source code analysis of open source API gateway APIs IX
Caesar
Custom events of components ②
[R language] two /n data merge functions
关系数据库如何工作
038 network security JS
How to make the two financial transactions faster
Sqlalchemy creating MySQL_ Table
[MySQL learning notes 26] view









