当前位置:网站首页>Anti clockwise rotation method of event arrangement -- PHP implementation
Anti clockwise rotation method of event arrangement -- PHP implementation
2022-07-04 12:05:00 【Take a glass of water from the sky】
// Counterclockwise rotation method
public function anticlockwise()
{
$n = 6;
if ($n % 2 == 0) {
$count = range(1, $n);
} else {
$count = range(1, $n + 1);
$count[$n] = 0;
}
$leftArr = array_slice($count, 0, count($count) / 2);
$rightArr = array_slice($count, count($count) / 2, count($count));
$tmp = [];
for ($i = 0; $i < count($count) / 2; $i++) {
$tmp[$i] = $rightArr[count($count) / 2 - $i - 1];
}
$rightArr = $tmp;
for ($i = 0; $i < count($count) - 1; $i++) {
echo ' The first ' . ($i + 1) . ' round </br>';
for ($j = 0; $j < count($leftArr); $j++) {
echo $leftArr[$j] . '---' . $rightArr[$j] . '</br>';
}
$x1 = $leftArr[count($leftArr) - 1];
$x2 = $rightArr[0];
for ($x = 0; $x < count($leftArr) - 2; $x++) {
$leftArr[count($leftArr) - ($x + 1)] = $leftArr[count($leftArr) - ($x + 2)];
}
for ($x = 0; $x < count($rightArr) - 1; $x++) {
$rightArr[$x] = $rightArr[$x + 1];
}
$leftArr[1] = $x2;
$rightArr[count($rightArr) - 1] = $x1;
}
}
边栏推荐
- Login operation (for user name and password)
- Function parameters (positional parameters, default value parameters, variable parameters, named keyword parameters, keyword parameters)
- Dos and path
- Summary of Shanghai Jiaotong University postgraduate entrance examination module -- cryptography
- Understanding of object
- Install freeradius3 in the latest version of openwrt
- VPS installation virtualmin panel
- Reptile learning winter vacation series (2)
- Analysis function in SQL
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 9
猜你喜欢

Process communication and thread explanation

Decrypt the advantages of low code and unlock efficient application development
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12](/img/b1/926d9b3d7ce9c5104f3e81974eef07.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13](/img/29/49da279efed22706545929157788f0.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21](/img/73/4050a592fdd99bf06e8fd853b157b6.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21

Replace() function
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18](/img/1a/94ef8be5c06c2d1c52fc8ce7f03ea7.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8](/img/16/33f5623625ba817e6e022b5cb7ff5d.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14](/img/c5/dde92f887e8e73d7db869fcddc107f.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14

Serialization oriented - pickle library, JSON Library
随机推荐
Object. Assign () & JS (= >) arrow function & foreach () function
Possible to restore a backup of SQL Server 2014 on SQL Server 2012?
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7
Configure SSH key to realize login free
Method of setting default items in C # ComboBox control code
Automatic translation between Chinese and English
(August 9, 2021) example exercise of air quality index calculation (I)
Recommend a cool geospatial data visualization tool with low code
20 kinds of hardware engineers must be aware of basic components | the latest update to 8.13
AI should take code agriculture? Deepmind offers a programming version of "Alpha dog" alphacode that surpasses nearly half of programmers!
Take advantage of the world's sleeping gap to improve and surpass yourself -- get up early
Shift EC20 mode and switch
Is Sanli futures safe? How to open a futures account? How to reduce the handling charge of futures at present?
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14
Detailed array expansion analysis --- take you step by step analysis
QQ one click cookie acquisition
Introduction of network security research direction of Shanghai Jiaotong University
Configure SSH certificate login
Heartbeat error attempted replay attack