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

边栏推荐
- QT -- 1. QT connection database
- 2022 test questions and mock examinations for main principals of hazardous chemicals business units
- Day5: scanner object, next() and nextline(), sequential structure, selection structure, circular structure
- 2022制冷与空调设备运行操作国家题库模拟考试平台操作
- Custom events of components ①
- Latex table
- redisson使用全解——redisson官方文档+注释(上篇)
- Source code analysis of open source API gateway APIs IX
- 组件的自定义事件②
- The H5 page has set the font thickness style, but the wechat access style in Huawei mobile phone doesn't take effect?
猜你喜欢

Download xshell and xftp

Vhost kick & call principle

038 network security JS

Gui Gui programming (XV) - use scale to control font size changes

The database is locked. Is there a solution
![[kv260] generate chip temperature curve with xadc](/img/fc/e5e4648b09b1123b2d494b75a9f8f7.png)
[kv260] generate chip temperature curve with xadc

QT -- 1. QT connection database

组件的自定义事件②

TodoList经典案例①

Array: question brushing record
随机推荐
凸印的印刷原理及工艺介绍
Discussion on several research hotspots of cvpr2022
AUTOSAR learning record (1) – ECUM_ Init
PHP laravel wechat payment
[programming compulsory training 3] find the longest consecutive number string in the string + the number that appears more than half of the times in the array
Sorting out tcp/udp communication problems
Office365 - how to use stream app to watch offline files at any time
base64
Redisson utilise la solution complète - redisson Documents officiels + commentaires (Partie 1)
Redisson uses the full solution - redisson official documents + comments (Part 2)
IMDB practice of emotion classification (simplernn, LSTM, Gru)
SharePoint - how to quickly check whether SharePoint is standard or enterprise edition?
[software] phantomjs screenshot
软件测试方法和技术 - 基础知识概括
【R语言】年龄性别频数匹配 挑选样本 病例对照研究,对年龄性别进行频数匹配
Software testing methods and techniques - overview of basic knowledge
[website architecture] solve 90% of distributed transactions in one move, and introduce the working principles and application scenarios of database transactions and distributed transactions
[MySQL learning notes27] stored procedure
postgresql源码学习(26)—— Windows vscode远程调试Linux上的postgresql
Cyclic neural network