当前位置:网站首页>Output 0 ~ n digits and output multiple times
Output 0 ~ n digits and output multiple times
2022-06-25 14:18:00 【jason_ renyu】
Output 0~n And output it many times , This method is similar to the output 010101010101,012012012012012,012301230123, Such a sequence of numbers ;
In this way, the output sequence can make an array output several times in sequence , It is not clear what this method is called , Or it is not an algorithm , Put it here first. If you know, please leave a message below , thank you !
javascript The way
const sFun = (value, length, vflag) => {
let n = value;
// Judge whether the critical value is reached
// Default as value = 6, The returned number is 0-5 Six bit loop
if (vflag) {
n = value + 1;
}
let l = length + 1;
let page = 1;
let arr = [];
for (let i = 1; i < l; i++) {
let resultN = n + (i - page * n - 1);
arr.push(resultN)
if (i % n == 0) {
page++
}
}
return arr;
}
console.log(sFun(6, 100, true))
Java The method is followed by …
边栏推荐
- Report on Hezhou air32f103cbt6 development board
- 多台云服务器的 Kubernetes 集群搭建
- 超酷汇编教程-- 简明x86汇编语言教程(1)
- [proteus simulation] 51 MCU +ds1302+lcd1602 display
- Dialogue: recommended system quick start route and summary of knowledge points
- k线图24种经典图解(影线篇)
- Installation and removal of MySQL under Windows
- 两种方法实现pycharm中代码回滚到指定版本(附带截图展示)
- shell 字符串变量
- Beego--- notes
猜你喜欢

深入理解深度神经网络背后的数学(Mysteries of Neural Networks Part I)

To make pytorch faster, you need to master these 17 methods

Page 112 machine learning - review of fundamentals of mathematics pptx

shell 字符串变量

Graph contractual learning with augmentations

算力&NFT交易平台F3.xyz旗下独家权益NFT项目Hash Eagle将盛大发行

Getting started with shell variables

多台云服务器的 Kubernetes 集群搭建

k线图24种经典图解(影线篇)

Test your earning power? What will you do in the future?
随机推荐
Table de hachage, conflit de hachage
当了六年程序员第一次搞懂微服务架构的数据一致性,真不容易
Pourquoi les programmeurs devraient - ils être plus doux?
Mise en place d'un Cluster kubernets avec plusieurs serveurs Cloud
Golang project dependency management tool go vendor, go Mod
DE2-115 FPGA开发板的VGA显示
JS functions
mysql数据库压缩备份_Mysql备份压缩及恢复数据库方法总结
"Mobile cloud Cup" computing power network application innovation competition is in hot registration!
Page 112 machine learning - review of fundamentals of mathematics pptx
Garbage collection mechanism
深入理解深度神经网络背后的数学(Mysteries of Neural Networks Part I)
TSDB在民机行业中的应用
楼宇自动化专用BACnet网关BL103
Summary of common functions in Oracle Database
Is it safe to open an account with tongdaxin stock?
Cool assembly tutorial - concise x86 assembly language tutorial (1)
多臺雲服務器的 Kubernetes 集群搭建
Is it safe for Guosen Securities to open an account?
Logistic Regression VS Linear Regression