1213 日 , 2024 23:59:08
HowieHz同志使用Simple(不完全标准)写的排序算法,真的是狠人!
put '输入需要排序的数字数量(n)之后回车。在之后输入需要排序的数字,输入完之后回车\n'
put 'n = '
key n
num n

a : [0]*n

iii : 0
num iii
:: read_array_loop
iii == n -> read_array_end
put 'array'
put iii
put ' = '
key a[iii]
num a[iii]
iii : iii+1
-> read_array_loop
:: read_array_end

i : 0
num i
temp : 0
num temp
j : 0
num j

:: loop
i == n -> end
j : i + 1
:: loop2
j == n -> end2
a[i] > a[j] -> swap
-> next_j

:: swap
temp : a[i]
a[i] : a[j]
a[j] : temp

:: next_j
j : j+1
-> loop2
:: end2
i : i+1
-> loop
:: end

ii : 0
num ii
:: print_loop
ii == n -> print_end
put a[ii]
put ' '
ii : ii+1
-> print_loop
:: print_end
put '\n'

评论

  1. 2 周前
    2024-12-14 0:17:14

    so fun

  2. 2 周前
    2024-12-14 0:09:40

    原始 C++ 代码φ( ̄∇ ̄o)

    #include<bits/stdc++.h>
    using namespace std;
    #define ios ios::sync_with_stdio(false), cin.tie(nullptr)
    
    void solve() {
        int a[] = {5, 3, 8, 4, 2};
        int n = sizeof(a) / sizeof(a[0]);
    
        int i = 0;
        int temp = 0;
        int j = 0;
    
        loop:
        if (i == n) goto end;
        j = i + 1;
        loop2:
        if (j == n) goto end2;
        if (a[i] > a[j]) goto swap;
        goto next_j;
    
        swap:
        temp = a[i];
        a[i] = a[j];
        a[j] = temp;
    
        next_j:
        j++;
        goto loop2;
        end2:
        i++;
        goto loop;
        end:
    
        int ii = 0;
        print_loop:
        if (ii == n) goto print_end;
        cout << a[ii] << " ";
        ii++;
        goto print_loop;
        print_end:
        cout << endl;
    
        return;
    }
    
    int main() {
        ios;
        int T;
        T = 1;
        // cin >> T;
        while (T--) {
            solve();
        }
    }

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
呼呼