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

边栏推荐
- I bet on performance and won the CTO of the company. I want to build Devops platform!
- Sorting out tcp/udp communication problems
- QT -- 1. QT connection database
- H5 页面设置了字体的粗细样式,但是在华为手机里微信打开访问样式不生效?
- Rk3399 platform development series explanation (network debugging) 7.30. What will affect the sending process of TCP packets?
- [skill] create Bat quick open web page
- Lm08 mesh series mesh inversion (fine)
- [R language] age sex frequency matching select samples for case-control study, and perform frequency matching on age and sex
- Discussion on several research hotspots of cvpr2022
- 凸印的印刷原理及工艺介绍
猜你喜欢

redisson使用全解——redisson官方文档+注释(上篇)

Office365 - how to use stream app to watch offline files at any time

Inftnews | from "avalanche" to Baidu "xirang", 16 major events of the meta universe in 30 years

The database is locked. Is there a solution

Vhost kick & call principle
![[untitled]](/img/c2/63286ba00321c9cdef43ff40635a67.png)
[untitled]

IMDB practice of emotion classification (simplernn, LSTM, Gru)

base64

038 network security JS

软件测试方法和技术 - 基础知识概括
随机推荐
TCP/UDP 通信问题整理
Redisson uses the full solution - redisson official document + comments (Part 2)
Stepsister becomes stepmother, son breaks off relationship with himself, and musk, the world's richest man, why is it so miserable?
ContentType所有类型对比
2022制冷与空调设备运行操作国家题库模拟考试平台操作
Missing API interface actual development series (14): ID card real name authentication verification
2022 mobile crane driver test exercises and online simulation test
Custom events of components ①
Wang Yingqi, founder of ones, talks to fortune (Chinese version): is there any excellent software in China?
PWN攻防世界int_overflow
Browser local storage
Principle and process of embossing
[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
组件的自定义事件①
Implementation and encapsulation of go universal dynamic retry mechanism
kubernetes资源对象介绍及常用命令(二)
【mysql学习笔记26】视图
PHP laravel wechat payment
How to use layui to display the data in the database in the form of tables
Android screen adaptation (using constraintlayout), kotlin array sorting