答:
PowerShell v2+, 43 bytes

```<code>param($n)-join(1..$n.length|%{$n[0..--$_]})
</code>```

Takes input $n, loops from 1 to $n.length, each iteration slicing $n from 0 up to one less than the current number -- done because .length is 1-indexed, while array slicing is 0-indexed. Each iteration places characters on the pipeline, those are encapsulated in parens and -joined together into one string. Output is implicit.

```<code>PS C:\Tools\Scripts\golfing> .\stringsplode-the-string.ps1 'PPCG'
PPPPPCPPCG
</code>```

Alternatively, using Jordan's Ruby submission as a basis, you can get to the following for 22 bytes

```<code>$input-replace'.','$`'
</code>```

This feels kinda cheaty, though, since you'd have to explicitly insert a newline into the string that you're piping in, or otherwise do a Get-Content or something out of a file that pulls the newlines with it. Valid, but not really common.

```<code>PS C:\Tools\Scripts\golfing> 'PPCG
' | .\stringsplode-the-string.ps1 $_
PPPPPCPPCG
</code>```

Title: Stringsplode the String!

Body:
PowerShell v2+, 43 bytes

param($n)-join(1..$n.length|%{$n[0..--$_]})

Takes input $n, loops from 1 to $n.length, each iteration slicing $n from 0 up to one less than the current number -- done because .length is 1-indexed, while array slicing is 0-indexed. Each iteration places characters on the pipeline, those are encapsulated in parens and -joined together into one string. Output is implicit.

PS C:\Tools\Scripts\golfing> .\stringsplode-the-string.ps1 'PPCG'
PPPPPCPPCG

Alternatively, using Jordan's Ruby submission as a basis, you can get to the following for 22 bytes

$input-replace'.','$`'

This feels kinda cheaty, though, since you'd have to explicitly insert a newline into the string that you're piping in, or otherwise do a Get-Content or something out of a file that pulls the newlines with it. Valid, but not really common.

PS C:\Tools\Scripts\golfing> 'PPCG
' | .\stringsplode-the-string.ps1 $_
PPPPPCPPCG


问:
Stringsplode the String!
The challenge is relatively simple, but will hopefully lead to some wonderfully creative answers. The task is to take a string as an input (via command line, function parameter etc.) and output/return a stringsploded version of it.

A stringsploded version of a string is its first letter followed by its first 2 letters, followed by its first 3 letters,... until you finally output the complete word.

You are guaranteed that the input will consist of printable ASCII characters and that the input will all be on one line (no new line characters).

Here are examples to clarify what stringsplosions are:

```<code>Input                 Output
==================================================================
"Code"       ---->   "CCoCodCode"
"name"       ---->   "nnanamname"
"harambe"    ---->   "hhaharharaharamharambharambe"
"sp aces?"   ---->   "sspsp sp asp acsp acesp acessp aces?"
"1234"       ---->   "1121231234"
"ss"         ---->   "sss"
</code>```

This is code golf so shortest code wins + up votes for interesting uses of your respective language.

Good luck!

答:
Javascript (ES6), <s>28</s> 26 bytes

Recursively appends the shortened strings to the left of the final result:

```<code>f=s=>s&&f(s.slice(0,-1))+s
</code>```

Examples

var
f=s=>s&&f(s.slice(0,-1))+s

console.log(f("Code"));     //  -->   "CCoCodCode"
console.log(f("name"));     //  -->   "nnanamname"
console.log(f("harambe"));  //  -->   "hhaharharaharamharambharambe"
console.log(f("sp aces?")); //  -->   "sspsp sp asp acsp acesp acessp aces?"
console.log(f("1234"));     //  -->   "1121231234"```

ContentLicense: CC BY-SA 3.0

Title: Stringsplode the String!

Body:
Javascript (ES6), <s>28</s> 26 bytes

Recursively appends the shortened strings to the left of the final result:

f=s=>s&&f(s.slice(0,-1))+s

Examples

var
f=s=>s&&f(s.slice(0,-1))+s

console.log(f("Code"));     //  -->   "CCoCodCode"
console.log(f("name"));     //  -->   "nnanamname"
console.log(f("harambe"));  //  -->   "hhaharharaharamharambharambe"
console.log(f("sp aces?")); //  -->   "sspsp sp asp acsp acesp acessp aces?"
console.log(f("1234"));     //  -->   "1121231234"


答:
BASH (grep + sed + tr) 36

```<code>grep -o .|sed ':;p;N;$!b'|tr -d '\n'
</code>```

Title: Stringsplode the String!

Body:
The challenge is relatively simple, but will hopefully lead to some wonderfully creative answers. The task is to take a string as an input (via command line, function parameter etc.) and output/return a stringsploded version of it.

A stringsploded version of a string is its first letter followed by its first 2 letters, followed by its first 3 letters,... until you finally output the complete word.

You are guaranteed that the input will consist of printable ASCII characters and that the input will all be on one line (no new line characters).

Here are examples to clarify what stringsplosions are:

```<code>Input                 Output
==================================================================
"Code"       ---->   "CCoCodCode"
"name"       ---->   "nnanamname"
"harambe"    ---->   "hhaharharaharamharambharambe"
"sp aces?"   ---->   "sspsp sp asp acsp acesp acessp aces?"
"1234"       ---->   "1121231234"
"ss"         ---->   "sss"
</code>```

This is code golf so shortest code wins + up votes for interesting uses of your respective language.

Good luck!

Body:
BASH (grep + sed + tr) 36

grep -o .|sed ':;p;N;$!b'|tr -d '\n'


问:
Print multiplication tables by input
In this challenge you've to print multiplication tables by input, Here are some examples:

```<code>Input: 2

Output:
0 2  4 6 8  10  12  14  16  18  20

Input: 20

Output: 20 40 60 80 100 120 140 160 180 200
</code>```

Rules

The shortest code in bytes wins.

This challenge is a code-golf, It follows code-golf general rules (code-golf)

If, just if, your code can't print number, you can use letters, Here is an example:

Input: B

Output: B D F H J L N P R T

You can choose to start from 0 or your number (like 20). You can choose if put spaces or don't. The challenge is free, just take an input and print multiplication tables.

Your output must list the first 10 members of the times table for the given number. You may leave out 0*n.

答:
Groovy (39 bytes for dynamic, 21 for static):

Dynamic (39 bytes)

```<code>{a,b,c->(a..b).collect{it*c}}(1,10,2)
</code>```

a is the starting point of the table

b is the ending point of the table.

c is the factor

(1, 10, 2) would print:

```<code>2
4
6
8
10
12
14
16
18
20
</code>```

Try it here:
https://groovyconsole.appspot.com/edit/5194081252671488

Partial Dynamic (29 bytes)

```<code>{n->(1..10).collect{it*n}}(2)
</code>```

Try it here: {same website, I can't post 3 links}/5080994763767808

Static (21 bytes)

```<code>(1..10).collect{it*2}
</code>```

Try it here: https://groovyconsole.appspot.com/script/5110807876599808

Original Post Mistakes

Edited because someone pointed out I had made mistakes, original version was:

```<code>def x(a,b,c){[a..b].each{println it*c}}
</code>```

Mistakes were:

Not including the call to the closure in the byte-count.

[a..b] instead of (a..b).

Title: Print multiplication tables by input

Body:
Groovy (39 bytes for dynamic, 21 for static):

Dynamic (39 bytes)

{a,b,c->(a..b).collect{it*c}}(1,10,2)

a is the starting point of the table

b is the ending point of the table.

c is the factor

(1, 10, 2) would print:

2
4
6
8
10
12
14
16
18
20

Try it here:
https://groovyconsole.appspot.com/edit/5194081252671488

Partial Dynamic (29 bytes)

{n->(1..10).collect{it*n}}(2)

Try it here: {same website, I can't post 3 links}/5080994763767808

Static (21 bytes)

(1..10).collect{it*2}

Try it here: https://groovyconsole.appspot.com/script/5110807876599808

Original Post Mistakes

Edited because someone pointed out I had made mistakes, original version was:

def x(a,b,c){[a..b].each{println it*c}}

Mistakes were:

Not including the call to the closure in the byte-count.

[a..b] instead of (a..b).


答:
V, 8 bytes

```<code>òÄ$xhòíî
</code>```

Try it online!

Title: Stringsplode the String!

Body:
V, 8 bytes

òÄ$xhòíî

Try it online!


问:
Simulate a Rubik's cube
A Rubik's cube has 6 colors: red, orange, yellow, white, blue, and green. Red and orange, yellow and white, and blue and green faces are on opposite sides.

Net of a solved Rubik's cube looks like this:

```<code> Y
BRGO
 W
</code>```

And the tiles look like this:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
B B B R R R G G G O O O
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Challenge

Given rotations, reversed rotations, or double rotations output what a solved cube will transform to, as ASCII art or as an image (whitespaces aren't necessary, may or may not exist, trailing whitespaces are allowed.).

Input will be rotation (and optional modifier). Rotation notation goes like: U(p), L(eft), F(ront), R(ight), B(ack), D(own); 2 (double), ' or i (inverse).

All normal rotations will be 90° clockwise, inverse ones will be counterclockwise.

Explanation about clockwiseness: Imagine the cube as you're looking at the red face, and the yellow face is at the top. Then rotate the cube so that the face that the program will rotate will face you. This is the way clockwiseness will work. (Except back face, you will rotate the cube horizontally in that case.)

Input

Input will be a list of moves.

Output

An ASCII art that represents the cube or an image of the net of the cube.

Examples

Input:  (empty)

Output:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
B B B R R R G G G O O O
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Input: U (up)

Output:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
R R R G G G O O O B B B
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Input: U' or Ui (inverse up)

Output:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
O O O B B B R R R G G G
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Input: U2 (double up)

Output:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
G G G O O O B B B R R R
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Input: L' (inversed left)

Output:

```<code>      R Y Y
      R Y Y
      R Y Y
B B B W R R G G G O O Y
B B B W R R G G G O O Y
B B B W R R G G G O O Y
      O W W
      O W W
      O W W
</code>```

Input: R (right)

Output:

```<code>      Y Y R
      Y Y R
      Y Y R
B B B R R W G G G Y O O
B B B R R W G G G Y O O
B B B R R W G G G Y O O
      W W O
      W W O
      W W O
</code>```

Input: U2 L' D (double up, inverse left, down)

Output:

```<code>      O Y Y
      R Y Y
      R Y Y
G B B W O O B B B R R Y
G B B W R R G G G O O Y
O O Y G B B W R R G G G
      R O O
      W W W
      W W W
</code>```

Rules

No loopholes allowed.

This is code-golf, so shortest code in bytes solving the problem wins.

Title: Simulate a Rubik's cube

Body:
C, <s>1715</s> <s>1709</s> <s>1686</s> <s>1336</s> 1328 bytes

25 bytes saved thanks to @KevinCruijssen!

No answers so far, so I decided to put my own solution.

#define m(a,b,c,d)t[c][d]=r[a][b];
#define n(a)m(a,0,a,2)m(a,1,a,5)m(a,2,a,8)m(a,3,a,1)m(a,5,a,7)m(a,6,a,0)m(a,7,a,3)m(a,8,a,6)
#define y memcpy
typedef char R[6][9];R t;F(R r){y(t,r,54);n(0)m(4,6,1,0)m(4,7,1,3)m(4,8,1,6)m(1,0,5,0)m(1,3,5,1)m(1,6,5,2)m(5,0,3,2)m(5,1,3,5)m(5,2,3,8)m(3,2,4,6)m(3,5,4,7)m(3,8,4,8)y(r,t,54);}B(R r){y(t,r,54);n(2)m(1,2,4,0)m(1,5,4,1)m(1,8,4,2)m(3,0,5,6)m(3,3,5,7)m(3,6,5,8)m(4,0,3,6)m(4,1,3,3)m(4,2,3,0)m(5,6,1,8)m(5,7,1,5)m(5,8,1,2)y(r,t,54);}L(R r){y(t,r,54);n(3)m(0,0,5,0)m(0,3,5,3)m(0,6,5,6)m(2,2,4,6)m(2,5,4,3)m(2,8,4,0)m(4,0,0,0)m(4,3,0,3)m(4,6,0,6)m(5,0,2,8)m(5,3,2,5)m(5,6,2,2)y(r,t,54);}E(R r){y(t,r,54);n(1)m(0,2,4,2)m(0,5,4,5)m(0,8,4,8)m(5,2,0,2)m(5,5,0,5)m(5,8,0,8)m(4,2,2,6)m(4,5,2,3)m(4,8,2,0)m(2,0,5,8)m(2,3,5,5)m(2,6,5,2)y(r,t,54);}U(R r){y(t,r,54);n(4)m(0,0,3,0)m(0,1,3,1)m(0,2,3,2)m(1,0,0,0)m(1,1,0,1)m(1,2,0,2)m(2,0,1,0)m(2,1,1,1)m(2,2,1,2)m(3,0,2,0)m(3,1,2,1)m(3,2,2,2)y(r,t,54);}D(R r){y(t,r,54);n(5)m(0,6,1,6)m(0,7,1,7)m(0,8,1,8)m(1,6,2,6)m(1,7,2,7)m(1,8,2,8)m(2,6,3,6)m(2,7,3,7)m(2,8,3,8)m(3,6,0,6)m(3,7,0,7)m(3,8,0,8)y(r,t,54);}a,b,c,d,e,o,p,l;f(char*z,R s){char c[6]="RGOBYW";for(;b<7;b++)for(a=0;a<10;)s[b][a++]=c[b];for(l=strlen(z);l-->0;){d=*z++;if(d-32){e=*z++;if(*z++-32)*z++;o=e-50?e-39?1:3:2;for(p=0;p++<o;)d-70?d-66?d-76?d-82?d-85?D(s):U(s):E(s):L(s):B(s):F(s);}}}

<a href="https://tio.run/nexus/bash#lVXbbts4EH3XVxDeDVaMaIeirEtDKQGySfoSoICBZLHQ6kGW5Va@yIatYuEY/vZ0Zki7zXofWsCgjjjkzDmHQ7kqO5am7OHTI7th1ddxPajefpvU06at2dItxVhUYsK7vCrySZFt8rLIx4VmznFN65Yc10lRCkXIBxQSUoASQgEgn1AIKCYUAZKEYkABoQRQxE/Jd2xZL6v1zul26xrmWPWl3LBRHhX5h0KPWKcf3RHb8P3O7cRGhEOuWxdzDiG7LwyKAQWEEkARIIgAD0koAOQTigChAojArEEUJ6QAoRaIiCFlwZ1D0gIRQAnfuRvREYvD3TkvRVVwt6mMu01l3K0oD/IyuTG7yY28EuKPvCJCyMtoQl6SGKLihBAqNqxRsfqR19M5L8wjT45IqmzmIstGnTQrYh0QSqwS5CUtQgWB9V/SDnRTWV7oXWi5qve8Hs55@cRBWW8kVQ4JGbfNqUh7UljnqFlav5C38YvOz/aAIq6KFCeEUHFIyPTAD7yez3kNrV@B9QvP4sjV9I1/csTHLrSnfOSKT99ywLhvHfZPPWAYBjhD0YCUvON1f84rtGdmelxSF8TWL9MZPvlubkAMKLbdp6wPke0viACK7Skf@/54ohABdOx7@b7v7QdD1GIl1mKhpy5e2ctXMWJbvqfrW8H1zXqjj5/u/v6rp6erjavHaazHnsfxpcykLlNfar6FL01eel6RVfjNweAi23abRd26r1wv@v0bWLWfZJevnqebqTvpB4rv69M7PnGK3ldZ3Q/lbd0PPtz618G1ooRrqLb2vHSl@aQfy9tJP4pgiHFIFA7h7b275dfPODzg8ITDHQ6PMOjD4fDWiJmYi6Velk3r/ileOIm@fNF7B3SDCS@5XwhY7Fxdse5Ls2Xwg/JsvWnarmk/D1jD5u3q38Fg4CCtBmg1aZboBlwBJc1FcONzWj11exfVP21PbPNhkTcF1/ViWzOzKP2@iDF2Uf131fprh9Tc06xD5eZQbp5mSs@h3B5nZlmgZ2kW6Zk9FstIaf49x@wCsswvAw9YQi4IbN1eDyxxfkFE@FMiwv8VYWcPDvx9Oc7nqrL/YKy/IuQ4gyt8st7vfu/t7Vmxpz/Y/Tc" rel="nofollow noreferrer" title="Bash – TIO Nexus">Try it online!

Ungolfed old version:

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>

typedef char Tile;
typedef Tile Face[10];
typedef Face Rubik[7];

void main_loop(Rubik);
void rubik_init(Rubik);
void rubik_print(Rubik);
void rotate(Rubik, char, char);
void print_tile(Rubik, int, int);

void F(Rubik);
void B(Rubik);
void L(Rubik);
void R(Rubik);
void U(Rubik);
void D(Rubik);

#define move(a, b, c, d) \
      temp[c][d] = rubik[a][b]

#define move_f(a) \
    move(a, 1, a, 3); \
    move(a, 2, a, 6); \
    move(a, 3, a, 9); \
    move(a, 4, a, 2); \
    move(a, 6, a, 8); \
    move(a, 7, a, 1); \
    move(a, 8, a, 4); \
    move(a, 9, a, 7)

void F(Rubik rubik) {
    Rubik temp;
    memcpy(temp, rubik, sizeof(Rubik));
    move_f(1);
    move(5, 7, 2, 1);
    move(5, 8, 2, 4);
    move(5, 9, 2, 7);
    move(2, 1, 6, 1);
    move(2, 4, 6, 2);
    move(2, 7, 6, 3);
    move(6, 1, 4, 3);
    move(6, 2, 4, 6);
    move(6, 3, 4, 9);
    move(4, 3, 5, 7);
    move(4, 6, 5, 8);
    move(4, 9, 5, 9);
    memcpy(rubik, temp, sizeof(Rubik));
}

void B(Rubik rubik) {
    Rubik temp;
    memcpy(temp, rubik, sizeof(Rubik));
    move_f(3);
    move(2, 3, 5, 1);
    move(2, 6, 5, 2);
    move(2, 9, 5, 3);
    move(4, 1, 6, 7);
    move(4, 4, 6, 8);
    move(4, 7, 6, 9);
    move(5, 1, 4, 7);
    move(5, 2, 4, 4);
    move(5, 3, 4, 1);
    move(6, 7, 2, 9);
    move(6, 8, 2, 6);
    move(6, 9, 2, 3);
    memcpy(rubik, temp, sizeof(Rubik));
}

void L(Rubik rubik) {
    Rubik temp;
    memcpy(temp, rubik, sizeof(Rubik));
    move_f(4);
    move(1, 1, 6, 1);
    move(1, 4, 6, 4);
    move(1, 7, 6, 7);
    move(3, 3, 5, 7);
    move(3, 6, 5, 4);
    move(3, 9, 5, 1);
    move(5, 1, 1, 1);
    move(5, 4, 1, 4);
    move(5, 7, 1, 7);
    move(6, 1, 3, 9);
    move(6, 4, 3, 6);
    move(6, 7, 3, 3);
    memcpy(rubik, temp, sizeof(Rubik));
}

void R(Rubik rubik) {
    Rubik temp;
    memcpy(temp, rubik, sizeof(Rubik));
    move_f(2);
    move(1, 3, 5, 3);
    move(1, 6, 5, 6);
    move(1, 9, 5, 9);
    move(6, 3, 1, 3);
    move(6, 6, 1, 6);
    move(6, 9, 1, 9);
    move(5, 3, 3, 7);
    move(5, 6, 3, 4);
    move(5, 9, 3, 1);
    move(3, 1, 6, 9);
    move(3, 4, 6, 6);
    move(3, 7, 6, 3);
    memcpy(rubik, temp, sizeof(Rubik));
}

void U(Rubik rubik) {
    Rubik temp;
    memcpy(temp, rubik, sizeof(Rubik));
    move_f(5);
    move(1, 1, 4, 1);
    move(1, 2, 4, 2);
    move(1, 3, 4, 3);
    move(2, 1, 1, 1);
    move(2, 2, 1, 2);
    move(2, 3, 1, 3);
    move(3, 1, 2, 1);
    move(3, 2, 2, 2);
    move(3, 3, 2, 3);
    move(4, 1, 3, 1);
    move(4, 2, 3, 2);
    move(4, 3, 3, 3);
    memcpy(rubik, temp, sizeof(Rubik));
}

void D(Rubik rubik) {
    Rubik temp;
    memcpy(temp, rubik, sizeof(Rubik));
    move_f(6);
    move(1, 7, 2, 7);
    move(1, 8, 2, 8);
    move(1, 9, 2, 9);
    move(2, 7, 3, 7);
    move(2, 8, 3, 8);
    move(2, 9, 3, 9);
    move(3, 7, 4, 7);
    move(3, 8, 4, 8);
    move(3, 9, 4, 9);
    move(4, 7, 1, 7);
    move(4, 8, 1, 8);
    move(4, 9, 1, 9);
    memcpy(rubik, temp, sizeof(Rubik));
}

int main(int argc, char *argv[]) {
    Rubik rubik;
    rubik_init(rubik);
    main_loop(rubik);
    return 0;
}

void main_loop(Rubik rubik) {
    char a, b;
    for (;;) {
        a=toupper(getchar());
        if (a == 'Q') break;
        if (a != 10) {
            b=toupper(getchar());
            if (b != 10) getchar();
            rotate(rubik, a, b);
        }
        rubik_print(rubik);
    }
}

void rubik_init(Rubik rubik) {
    int i,n;
    char c[7] = " RGOBYW";

    for (n=1; n<=7; n++)
        for (i=1; i<=10; i++)
            rubik[n][i] = c[n];
}

void rotate(Rubik rubik, char a, char b){
    int i = b == '2' ? 2 : b == '\'' || b == toupper('i') ? 3 : 1;
    int j;
    for (j=0; j<i; j++)
        if (a == 'F') F(rubik);
        else if (a == 'B') B(rubik);
        else if (a == 'L') L(rubik);
        else if (a == 'R') R(rubik);
        else if (a == 'U') U(rubik);
        else if (a == 'D') D(rubik);
        else;
}

void rubik_print(Rubik rubik) {
    int i,j,k;

    for (i=1; i<=9; i++)
        if (i%3==0) {
            print_tile(rubik,5,i);
            printf("\n");
        }
        else if (i%3==1) {
            printf("    ");
            print_tile(rubik,5,i);
        }
        else
            print_tile(rubik,5,i);

    printf("\n");

    for (k=1; k<=3; k++) {
        for (i=3; i<=6; i++) {
            for (j=k*3-2; j<=k*3; j++)
                print_tile(rubik, i%4+1, j);
            printf(" ");
        }
        printf("\n");
    }

    printf("\n");

    for (i=1; i<=9; i++)
        if (i%3==0) {
            print_tile(rubik, 6, i);
            printf("\n");
        }
        else if (i%3==1) {
            printf("    ");
            print_tile(rubik, 6, i);
        }
        else
            print_tile(rubik, 6, i);

}

void print_tile(Rubik rubik, int a, int b) {
    switch (rubik[a][b]) {
      case 'R':
        printf("R");
        break;
      case 'O':
        printf("O");
        break;
      case 'B':
        printf("B");
        break;
      case 'G':
        printf("G");
        break;
      case 'Y':
        printf("Y");
        break;
      case 'W':
        printf("W");
        break;
      default:
        exit(1);
    }
}


答:
PHP , 52 Bytes

```<code>for(;$i<strlen($t=$argv[1]);)echo substr($t,0,++$i);
</code>```

Title: Stringsplode the String!

Body:
PHP , 52 Bytes

for(;$i<strlen($t=$argv[1]);)echo substr($t,0,++$i);


Title: Stringsplode the String!

Body:
C <s>71</s> 67 Bytes

k;f(v){char*m,*n=v;while(*n++)for(k=0,m=v;k<n-v;k++)putchar(*m++);}


问:
Shortest 8-bit xor cipher
8-bit XOR encryption takes a single byte and XORs every byte in the file by that byte. Here is a reference program in C++:

```<code>/*xorcipher.cpp
 *Encrypts a file using 8-bit xor encrytpion
 */

#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;

int main(int argc, char** argv){
   ifstream* in = NULL;
   ofstream* out = NULL;

   if(argc < 3){
      cerr << "Usage: xor <key> <filename...>" << endl;
      exit(1);
   }

   int key = atoi(argv[1]);

   for(int x = 2; x < argc; x++){
      in = new ifstream(argv[x], ios::binary);
      if(!in->good()){
         cerr << "Error reading from " << argv[x] << endl;
         exit(1);
      }

      //Get file size
      in->seekg(0, ios::end);
      int size = in->tellg();
      in->seekg(0, ios::beg);

      //Allocate memory
      int* data = new int[size];

      int c = 0;
      for(int y = 0; (c = in->get()) != EOF; y++)
         data[y] = c ^ key;

      in->close();
      delete in;
      in = NULL;

      out = new ofstream(argv[x], ios::binary);
      if(!out->good()){
         cerr << "Error writing to " << argv[x] << endl;
         exit(1);
      }

      for(int y = 0; y < size; y++)
         out->put(data[y]);

      out->flush();
      out->close();
      delete out;
      out = NULL;

      delete[] data;
      data = NULL;
   }
   cout << "Operation complete" << endl;

   return 0;
}
</code>```

The shortest answer (whitespace doesn't count) that produces the same end result will be selected. It does not have to store everything in memory at once or open and close every file multiple times. It can do anything as long as a file encrypted with the reference program can be decrypted with the answer, and vice versa.

Edit: The above program is not a specification. The only requirement is that answers should be able to decrypt a file encrypted with the above program, and the above program should be able to decrypt a file encrypted with the answer. I'm sorry if that was unclear.

The above program can be compiled with:

```<code>g++ xorcipher.cpp -o ~/bin/xor
</code>```

It can be run like this:

```<code>xor <key> <filename...>
</code>```

For example, if the key is 42 and the file is alpha.txt, you would use:

```<code>xor 42 alpha.txt
</code>```

答:
Python, 78 chars

```<code>from sys import argv as v

print ''.join(chr(ord(v[1])^ord(i)) for i in open(v[2]).read())
</code>```

Must be run like:

```<code>python solution.py <key> <input_file> > <output_file>
</code>```

Where solution.py is the python file that contains the above code, key is the single byte to XOR, input_file is the file to be encrypted and output_file will contain the decrypted output.

I am not sure if it matches your solution (as per "...that produces the same end result will be selected") since your example doesn't seem to produce output. However, it does successfully decrypt an encrypted file with the same key byte.

Since whitespace doesn't count, I used the following code to count chars:

```<code>>>> with open('solution.py') as f:
...     text = f.read()
...
>>> len(text) - text.count('\n') - text.count(' ') # There are no tabs in this code
78
</code>```

Title: Shortest 8-bit xor cipher

Body:
Python, 78 chars

from sys import argv as v

print ''.join(chr(ord(v[1])^ord(i)) for i in open(v[2]).read())

Must be run like:

python solution.py <key> <input_file> > <output_file>

Where solution.py is the python file that contains the above code, key is the single byte to XOR, input_file is the file to be encrypted and output_file will contain the decrypted output.

I am not sure if it matches your solution (as per "...that produces the same end result will be selected") since your example doesn't seem to produce output. However, it does successfully decrypt an encrypted file with the same key byte.

Since whitespace doesn't count, I used the following code to count chars:

>>> with open('solution.py') as f:
...     text = f.read()
...
>>> len(text) - text.count('\n') - text.count(' ') # There are no tabs in this code
78


答:
Javascript (ES6), 34 31 bytes

```<code>a=>{for(i=0;i<11;)alert(++i*a)}
(a)=>{for(i=0;i<11;++i)alert(i*a)}
</code>```

Saved 3 bytes thanks to grizzly.

Title: Print multiplication tables by input

Body:
In this challenge you've to print multiplication tables by input, Here are some examples:

```<code>Input: 2

Output:
0 2  4 6 8  10  12  14  16  18  20

Input: 20

Output: 20 40 60 80 100 120 140 160 180 200
</code>```

Rules

The shortest code in bytes wins.

This challenge is a code-golf, It follows code-golf general rules (code-golf)

If, just if, your code can't print number, you can use letters, Here is an example:

Input: B

Output: B D F H J L N P R T

You can choose to start from 0 or your number (like 20). You can choose if put spaces or don't. The challenge is free, just take an input and print multiplication tables.

Your output must list the first 10 members of the times table for the given number. You may leave out 0*n.

Body:
Javascript (ES6), 34 31 bytes

a=>{for(i=0;i<11;)alert(++i*a)}
(a)=>{for(i=0;i<11;++i)alert(i*a)}

Saved 3 bytes thanks to grizzly.


答:
Perl, 10 bytes

Includes +1 for -p

Run with the input on STDIN:

```<code>splode.pl <<< "Hello"
</code>```

splode.pl

```<code>#!/usr/bin/perl -p
s/./$`/sg
</code>```

This depends on the input being terminated by a newline. This 11 byte version does not need a final newline:

```<code>#!/usr/bin/perl -lp
s/.?/$`/g
</code>```

Title: Stringsplode the String!

Body:
Perl, 10 bytes

Includes +1 for -p

Run with the input on STDIN:

splode.pl <<< "Hello"

splode.pl

#!/usr/bin/perl -p
s/./$`/sg

This depends on the input being terminated by a newline. This 11 byte version does not need a final newline:

#!/usr/bin/perl -lp
s/.?/$`/g


答:
gs2, 1 byte

x

gs2 takes input from STDIN, and pushes it to the stack as a string.

x is the prefixes built-in, returning a list of all prefixes of the argument, in ascending-length order.

The resulting list of strings is implicitly printed one-by-one, without a delimiter, when the program terminates.

Title: Stringsplode the String!


Title: Stringsplode the String!

Body:
sed 41

h;:;G;s,.\n,\n,;h;s,\n.*,,;/./b;x;s,\n,,g


答:
Brain-Flak <s>50</s> 46 bytes

Try it online

```<code><>((()()())({}){}){({}[()]<(({})<>({})<>)>)}{}
</code>```

Explanation

Switch to the off stack and push 9:

```<code><>((()()())({}){})
</code>```

Decrement the nine until zero

```<code>{({}[()]<...>)}{}
</code>```

Each time add the input value a copy of the top value

```<code>(({})<>({})<>)
</code>```

Title: Print multiplication tables by input

Body:
Brain-Flak <s>50</s> 46 bytes

Try it online

<>((()()())({}){}){({}[()]<(({})<>({})<>)>)}{}

Explanation

Switch to the off stack and push 9:

<>((()()())({}){})

Decrement the nine until zero

{({}[()]<...>)}{}

Each time add the input value a copy of the top value

(({})<>({})<>)


答:
Pyke, 5 bytes

```<code>FKoh<
</code>```

Try it here!

```<code>      - o = 0
FK    - for i in input:
  oh  -   1+o++
    < -  input[:^]
      - "".join(^)
</code>```

Title: Stringsplode the String!

Body:
Pyke, 5 bytes

FKoh<

Try it here!

      - o = 0
FK    - for i in input:
  oh  -   1+o++
    < -  input[:^]
      - "".join(^)


答:
Sesos, 4 bytes

```<code>0000000: 8073ec 09                                         .s..
</code>```

Try it online! Check Debug to see the generated SBIN code.

Sesos assembly

The binary file above has been generated by assembling the following SASM code.

    jmp, rwd 1, jnz
    fwd 1
    jmp, put, fwd 1, jnz
jnz
```

Title: Stringsplode the String!

Body:
Sesos, 4 bytes

0000000: 8073ec 09                                         .s..

Try it online! Check Debug to see the generated SBIN code.

Sesos assembly

The binary file above has been generated by assembling the following SASM code.

    jmp, rwd 1, jnz
    fwd 1
    jmp, put, fwd 1, jnz
jnz


问:
Greater than less than greater than something fishy
Given a length N string of less-than and greater-than signs (<, >), insert the integers 0 through N at the start and end and in between each pair of signs such that all the inequalities are satisfied. Output the resulting string. If there are multiple valid outputs, output any one (and just one) of them.

For example

```<code><<><><<
</code>```

has 7 characters so all the numbers from 0 to 7 inclusive must be inserted. A valid output is

```<code>2<3<4>1<5>0<6<7
</code>```

because all the inequalities taken one at a time

```<code>2<3
3<4
4>1
1<5
5>0
0<6
6<7
</code>```

are true.

If desired, the output may have spaces surrounding the signs, e.g. 2 < 3 < 4 > 1 < 5 > 0 < 6 < 7.

The shortest code in bytes wins.

Test Cases

The first line after an empty line is the input and the next line(s) are each valid output examples.

```<code>[empty string]
0

<
0<1

>
1>0

<<
0<1<2

<>
1<2>0

><
1>0<2
2>0<1

>>
2>1>0

<<<
0<1<2<3

><>
1>0<3>2

>><
3>2>0<1
3>1>0<2
2>1>0<3

>>>
3>2>1>0

>>><<<
3>2>1>0<4<5<6
6>3>1>0<2<4<5
4>2>1>0<3<5<6
4>3>1>0<2<5<6

<<><><<
2<3<4>1<5>0<6<7

>><><>>
7>6>0<5>1<4>3>2

<<<<<<<<<<<<<<
0<1<2<3<4<5<6<7<8<9<10<11<12<13<14

>><<<<><>><><<
6>5>4<7<8<9<10>3<11>2>1<12>0<13<14
14>5>4<7<8<9<10>3<11>2>1<12>0<13<6
</code>```

答:
><>, <s>46</s> <s>43</s> 35 + 4 for  -s= = 39 bytes

```<code>0&l?!v:3%?\&:n1+$o!
+nf0.>&n; >l&:@
</code>```

This is an implementation of xnor's algorithm in ><>.

It takes the input string on the stack (-s flag with the standard interpreter).

You can try it out on the online interpreter.

Body:
><>, <s>46</s> <s>43</s> 35 + 4 for  -s= = 39 bytes

0&l?!v:3%?\&:n1+$o!
+nf0.>&n; >l&:@

This is an implementation of xnor's algorithm in ><>.

It takes the input string on the stack (-s flag with the standard interpreter).

You can try it out on the online interpreter.


问:
Fluctuating ranges
Given a list with number, output the ranges like this:

Input: [0, 5, 0] would become [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0].

This is mapping a range through the array, so we first have to create the range [0, 5], which is [0, 1, 2, 3, 4, 5]. After that, we use the 5 to create the range [5, 0]. Appended at our previous range, this gives us:

```<code>[0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]
</code>```

Let's observe a test case with two same digits next to each other:

```<code>[3, 5, 5, 3], ranges:

[3, 5] = 3, 4, 5
[5, 5] = 5 (actually [5, 5] due to overlapping)
[5, 3] = 5, 4, 3
</code>```

So this would give us [3, 4, 5, 5, 4, 3].

Some other test cases:

```<code>[1, 9] > [1, 2, 3, 4, 5, 6, 7, 8, 9]
[10, -10] > [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]
[3, 0, 0, -3] > [3, 2, 1, 0, 0, -1, -2, -3]
[1, 3, 5, 7, 5, 3, 1, -1, -3] > [1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3]
</code>```

Input will always have at least 2 integers.

Shortest answer wins!

答:
Perl, 47 bytes

Includes +3 for -p (code contains $' so space and - count too)

Give the list of numbers on STDIN:

```<code>fluctuating.pl <<< "3 5 5 3"
</code>```

fluctuating.pl:

```<code>#!/usr/bin/perl -p
($n=$&+($'<=>$&))-$'&&s/\G/$n / while/\S+ /g
</code>```

The temporary variable and all these parenthesis feel suboptimal...

Title: Fluctuating ranges

Body:
Perl, 47 bytes

Includes +3 for -p (code contains $' so space and - count too)

Give the list of numbers on STDIN:

fluctuating.pl <<< "3 5 5 3"

fluctuating.pl:

#!/usr/bin/perl -p
($n=$&+($'<=>$&))-$'&&s/\G/$n / while/\S+ /g

The temporary variable and all these parenthesis feel suboptimal...


答:
R, <s>60</s> 49 bytes

Not going to win any golf, but hopefully no shorter R answer is possible

```<code>cat(substring(s<-readline(),1,1:nchar(s)),sep="")
</code>```

<s>paste0(substring(s<-readLines(,1),1,1:nchar(s)),collapse="")
</s>

Thanks @MickyT

Title: Stringsplode the String!

Body:
R, <s>60</s> 49 bytes

Not going to win any golf, but hopefully no shorter R answer is possible

cat(substring(s<-readline(),1,1:nchar(s)),sep="")

<s>paste0(substring(s<-readLines(,1),1,1:nchar(s)),collapse="")
</s>

Thanks @MickyT


答:
Postscript 101 67

```<code>(]){exch def}def
ARGUMENTS aload pop(w)file/O](r)file/I]cvi/K]{O I read not{exit}if K xor write}loop
</code>```

The 67 byte version is equivalent to the above with all executable system names replaced by binary tokens. It is produced as output by this program (which shows a hex representation).

```<code>(xorb.ps)(w)file
<
    285D297B923E92337D9233
    415247554D454E54539202927528772992412F4F5D
    28722992412F495D922C2F4B5D
    7B4F2049927B92707B92407D92544B92C192BC7D9265
>
writestring
</code>```

Invoke with ghostscript's argument-processing option --.

```<code>josh@Z1 ~
$ gs -dNODISPLAY -- xorw.ps
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

josh@Z1 ~
$ xxd xorb.ps
0000000: 285d 297b 923e 9233 7d92 3341 5247 554d  (]){.>.3}.3ARGUM
0000010: 454e 5453 9202 9275 2877 2992 412f 4f5d  ENTS...u(w).A/O]
0000020: 2872 2992 412f 495d 922c 2f4b 5d7b 4f20  (r).A/I].,/K]{O
0000030: 4992 7b92 707b 9240 7d92 544b 92c1 92bc  I.{.p{.@}.TK....
0000040: 7d92 65                                  }.e

josh@Z1 ~
$ gs -dNODISPLAY -- xorb.ps 42 xor.ps xor.ps.out
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

josh@Z1 ~
$ gs -dNODISPLAY -- xorb.ps 42 xor.ps.out xor.rev
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

josh@Z1 ~
$ diff xor.ps xor.rev

josh@Z1 ~
$
</code>```

Title: Shortest 8-bit xor cipher

Body:
8-bit XOR encryption takes a single byte and XORs every byte in the file by that byte. Here is a reference program in C++:

```<code>/*xorcipher.cpp
 *Encrypts a file using 8-bit xor encrytpion
 */

#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;

int main(int argc, char** argv){
   ifstream* in = NULL;
   ofstream* out = NULL;

   if(argc < 3){
      cerr << "Usage: xor <key> <filename...>" << endl;
      exit(1);
   }

   int key = atoi(argv[1]);

   for(int x = 2; x < argc; x++){
      in = new ifstream(argv[x], ios::binary);
      if(!in->good()){
         cerr << "Error reading from " << argv[x] << endl;
         exit(1);
      }

      //Get file size
      in->seekg(0, ios::end);
      int size = in->tellg();
      in->seekg(0, ios::beg);

      //Allocate memory
      int* data = new int[size];

      int c = 0;
      for(int y = 0; (c = in->get()) != EOF; y++)
         data[y] = c ^ key;

      in->close();
      delete in;
      in = NULL;

      out = new ofstream(argv[x], ios::binary);
      if(!out->good()){
         cerr << "Error writing to " << argv[x] << endl;
         exit(1);
      }

      for(int y = 0; y < size; y++)
         out->put(data[y]);

      out->flush();
      out->close();
      delete out;
      out = NULL;

      delete[] data;
      data = NULL;
   }
   cout << "Operation complete" << endl;

   return 0;
}
</code>```

The shortest answer (whitespace doesn't count) that produces the same end result will be selected. It does not have to store everything in memory at once or open and close every file multiple times. It can do anything as long as a file encrypted with the reference program can be decrypted with the answer, and vice versa.

Edit: The above program is not a specification. The only requirement is that answers should be able to decrypt a file encrypted with the above program, and the above program should be able to decrypt a file encrypted with the answer. I'm sorry if that was unclear.

The above program can be compiled with:

```<code>g++ xorcipher.cpp -o ~/bin/xor
</code>```

It can be run like this:

```<code>xor <key> <filename...>
</code>```

For example, if the key is 42 and the file is alpha.txt, you would use:

```<code>xor 42 alpha.txt
</code>```

Body:
Postscript 101 67

(]){exch def}def
ARGUMENTS aload pop(w)file/O](r)file/I]cvi/K]{O I read not{exit}if K xor write}loop

The 67 byte version is equivalent to the above with all executable system names replaced by binary tokens. It is produced as output by this program (which shows a hex representation).

(xorb.ps)(w)file
<
    285D297B923E92337D9233
    415247554D454E54539202927528772992412F4F5D
    28722992412F495D922C2F4B5D
    7B4F2049927B92707B92407D92544B92C192BC7D9265
>
writestring

Invoke with ghostscript's argument-processing option --.

josh@Z1 ~
$ gs -dNODISPLAY -- xorw.ps
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

josh@Z1 ~
$ xxd xorb.ps
0000000: 285d 297b 923e 9233 7d92 3341 5247 554d  (]){.>.3}.3ARGUM
0000010: 454e 5453 9202 9275 2877 2992 412f 4f5d  ENTS...u(w).A/O]
0000020: 2872 2992 412f 495d 922c 2f4b 5d7b 4f20  (r).A/I].,/K]{O
0000030: 4992 7b92 707b 9240 7d92 544b 92c1 92bc  I.{.p{.@}.TK....
0000040: 7d92 65                                  }.e

josh@Z1 ~
$ gs -dNODISPLAY -- xorb.ps 42 xor.ps xor.ps.out
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

josh@Z1 ~
$ gs -dNODISPLAY -- xorb.ps 42 xor.ps.out xor.rev
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

josh@Z1 ~
$ diff xor.ps xor.rev

josh@Z1 ~
$


答:
Japt, 6 bytes

```<code>UòA*UU
</code>```

Test it online!

How it works

```<code>        // Implicit: U = input integer, A = 10
Uò      // Create a range from U to
  A*U   //  10 * U,
     U  //  skipping by U each time.
        // Implicit: output last expression
</code>```

Title: Print multiplication tables by input

Body:
Japt, 6 bytes

UòA*UU

Test it online!

How it works

        // Implicit: U = input integer, A = 10
Uò      // Create a range from U to
  A*U   //  10 * U,
     U  //  skipping by U each time.
        // Implicit: output last expression


答:
Perl, 19 bytes

Includes +1 for -n

Run with the input on STDIN:

```<code>perl -M5.1010 -n table.pl <<< 8
</code>```

table.pl:

```<code>say$_*$`for/$/..10
</code>```

Title: Print multiplication tables by input

Body:
Perl, 19 bytes

Includes +1 for -n

Run with the input on STDIN:

perl -M5.1010 -n table.pl <<< 8

table.pl:

say$_*$`for/$/..10


答:
Clojure, <s>152</s> <s>132</s> 126 bytes

(defn f[s](loop[l 0 h(count s)[c & r]s a""](if c(case c\<(recur(inc l)h r(str a l c))(recur l(dec h)r(str a h c)))(str a l))))
```

<p>Saved a fair number of bytes by eliminating as much whitespace as I could. I realized whitespace isn't necessary to separate a parenthesis from another character.</p>

<p>Basically a Clojure port of @Scepheo's answer. Works identically.</p>

<p>Those <code>recur</code> calls are killer! <s>I suppose I could have used atoms to clean it up.</s> The <code>swap!</code> calls required to use atoms added to the count :/</p>

<p>Thanks to @amalloy for saving me a few bytes.</p>

<p>Ungolfed:</p>

<pre class="lang-clj prettyprint-override"><code>(defn comp-chain [chain-str]
  (loop [l 0 ; Lowest number
         h (count chain-str) ; Highest number
         [c & cr] chain-str ; Deconstruct the remaining list
         a ""] ; Accumulator
    (if c ; If there's any <>'s left
      (if (= c \<) ; If current char is a <...
        (recur (inc l) h cr (str a l c)) ; Add l to a, and inc l
        (recur l (dec h) cr (str a h c))) ; Add h to a, and dec h
      (str a l)))) ; Add on the remaining lowest number, and return
</code>```

Title: Greater than less than greater than something fishy

Body:
Given a length N string of less-than and greater-than signs (<, >), insert the integers 0 through N at the start and end and in between each pair of signs such that all the inequalities are satisfied. Output the resulting string. If there are multiple valid outputs, output any one (and just one) of them.

For example

```<code><<><><<
</code>```

has 7 characters so all the numbers from 0 to 7 inclusive must be inserted. A valid output is

```<code>2<3<4>1<5>0<6<7
</code>```

because all the inequalities taken one at a time

```<code>2<3
3<4
4>1
1<5
5>0
0<6
6<7
</code>```

are true.

If desired, the output may have spaces surrounding the signs, e.g. 2 < 3 < 4 > 1 < 5 > 0 < 6 < 7.

The shortest code in bytes wins.

Test Cases

The first line after an empty line is the input and the next line(s) are each valid output examples.

```<code>[empty string]
0

<
0<1

>
1>0

<<
0<1<2

<>
1<2>0

><
1>0<2
2>0<1

>>
2>1>0

<<<
0<1<2<3

><>
1>0<3>2

>><
3>2>0<1
3>1>0<2
2>1>0<3

>>>
3>2>1>0

>>><<<
3>2>1>0<4<5<6
6>3>1>0<2<4<5
4>2>1>0<3<5<6
4>3>1>0<2<5<6

<<><><<
2<3<4>1<5>0<6<7

>><><>>
7>6>0<5>1<4>3>2

<<<<<<<<<<<<<<
0<1<2<3<4<5<6<7<8<9<10<11<12<13<14

>><<<<><>><><<
6>5>4<7<8<9<10>3<11>2>1<12>0<13<14
14>5>4<7<8<9<10>3<11>2>1<12>0<13<6
</code>```

Body:
Clojure, <s>152</s> <s>132</s> 126 bytes

(defn f[s](loop[l 0 h(count s)[c & r]s a""](if c(case c\<(recur(inc l)h r(str a l c))(recur l(dec h)r(str a h c)))(str a l))))

Saved a fair number of bytes by eliminating as much whitespace as I could. I realized whitespace isn't necessary to separate a parenthesis from another character.

Basically a Clojure port of @Scepheo's answer. Works identically.

Those recur calls are killer! <s>I suppose I could have used atoms to clean it up.</s> The swap! calls required to use atoms added to the count :/

Thanks to @amalloy for saving me a few bytes.

Ungolfed:

(defn comp-chain [chain-str]
  (loop [l 0 ; Lowest number
         h (count chain-str) ; Highest number
         [c & cr] chain-str ; Deconstruct the remaining list
         a ""] ; Accumulator
    (if c ; If there's any <>'s left
      (if (= c \<) ; If current char is a <...
        (recur (inc l) h cr (str a l c)) ; Add l to a, and inc l
        (recur l (dec h) cr (str a h c))) ; Add h to a, and dec h
      (str a l)))) ; Add on the remaining lowest number, and return


问:
Obfuscated FizzBuzz Golf
Create the shortest possible obfuscated FizzBuzz implementation.

To be considered obfuscated, it should satisfy at least one of the following:

Does not contain any of the words "Fizz", "Buzz", or "FizzBuzz"

Does not contain the numbers 3, 5, or 15.

Use any of the above in a misleading way.

Remember: The goal is to be short and hard to follow.

The code sample which inspired this question follows:

```<code>public class Default
{
        enum FizzBuzz
        {
            Buzz = 1,
            Fizz,
            FizzBuzz
        }
        public static void Main(string[] args)
        {
            byte[] foo =
              Convert.FromBase64String("IAmGMEiCIQySYAiDJBjCIAmGMEiCIQySYA==");
            MemoryStream ms = new MemoryStream(foo);
            byte[] myByte = new byte[1];
            do
            {
                FizzBuzz fb;
                ms.Read(myByte, 0, 1);
                for (int i = 0; i < 4; i++)
                {
                    fb = (FizzBuzz)(myByte[0] >> (2 * i)
                         & (int)FizzBuzz.FizzBuzz);
                    Console.Out.WriteLine( (((int)fb > 0) ? "" + fb : ""
                         + ((ms.Position - 1) * 4 + i + 1)));
                }
            } while (ms.Position < ms.Length);
        }
}
</code>```

答:
gs2, 1 byte

```<code>f
</code>```

prints fizzbuzz, gs2 has a very simple function

ContentLicense: CC BY-SA 2.5

Title: Obfuscated FizzBuzz Golf

Body:
gs2, 1 byte

f

prints fizzbuzz, gs2 has a very simple function


问:
Produce the number 2014 without any numbers in your source code

Note to challenge writers as per meta consensus:
This question was well-received when it was posted, but challenges
like this, asking answerers to Do X without using
Y
are likely to be poorly received. Try using the
sandbox
to get feedback on if you want to post a similar challenge.

It's <s>2017</s> <s>2018</s> <s>2019</s> <s>2020</s> <s>2021</s> <s>2022</s> 2023 already, folks, go home.

So, now that it's 2014, it's time for a code question involving the number 2014.

Your task is to make a program that prints the number 2014, without using any of the characters 0123456789 in your code, and independently of any external variables such as the date or time or a random seed.

The shortest code (counting in bytes) to do so in any language in which numbers are valid tokens wins.

Leaderboard:

var QUESTION_ID=17005,OVERRIDE_USER=7110;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Java 8, 33 bytes

```<code>()->Integer.parseInt("bbc",'\r');
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Java 8, 33 bytes

()->Integer.parseInt("bbc",'\r');


答:
Cubix, 24 bytes

```<code>;;..I1.N-?W.;;)W@/So..*O
</code>```

Cubix is a 2-dimensional, stack-based esolang. Cubix is different from other 2D langs in that the source code is wrapped around the outside of a cube.

Test it online! Note: you'll have to copy-paste the code, and there's a 50 ms delay between iterations.

Explanation

The first thing the interpreter does is figure out the smallest cube that the code will fit onto. In this case, the edge-length is 1. Then the code is padded with no-ops . until all six sides are filled. Whitespace is removed before processing, so this code is identical to the above:

```<code>    ; ;
    . .
I 1 . N - ? W .
; ; ) W @ / S o
    . .
    * O
</code>```

Title: Print multiplication tables by input

Body:
In this challenge you've to print multiplication tables by input, Here are some examples:

```<code>Input: 2

Output:
0 2  4 6 8  10  12  14  16  18  20

Input: 20

Output: 20 40 60 80 100 120 140 160 180 200
</code>```

Rules

The shortest code in bytes wins.

This challenge is a code-golf, It follows code-golf general rules (code-golf)

If, just if, your code can't print number, you can use letters, Here is an example:

Input: B

Output: B D F H J L N P R T

You can choose to start from 0 or your number (like 20). You can choose if put spaces or don't. The challenge is free, just take an input and print multiplication tables.

Your output must list the first 10 members of the times table for the given number. You may leave out 0*n.

Body:
Cubix, 24 bytes

;;..I1.N-?W.;;)W@/So..*O

Cubix is a 2-dimensional, stack-based esolang. Cubix is different from other 2D langs in that the source code is wrapped around the outside of a cube.

Test it online! Note: you'll have to copy-paste the code, and there's a 50 ms delay between iterations.

Explanation

The first thing the interpreter does is figure out the smallest cube that the code will fit onto. In this case, the edge-length is 1. Then the code is padded with no-ops . until all six sides are filled. Whitespace is removed before processing, so this code is identical to the above:

    ; ;
    . .
I 1 . N - ? W .
; ; ) W @ / S o
    . .
    * O


答:
Gema, 16 characters

```<code>?=@append{s;?}$s
</code>```

Sample run:

```<code>bash-4.3$ echo -n 'sp aces?' | gema '?=@append{s;?}$s'
sspsp sp asp acsp acesp acessp aces?
</code>```

Title: Stringsplode the String!

Body:
The challenge is relatively simple, but will hopefully lead to some wonderfully creative answers. The task is to take a string as an input (via command line, function parameter etc.) and output/return a stringsploded version of it.

A stringsploded version of a string is its first letter followed by its first 2 letters, followed by its first 3 letters,... until you finally output the complete word.

You are guaranteed that the input will consist of printable ASCII characters and that the input will all be on one line (no new line characters).

Here are examples to clarify what stringsplosions are:

```<code>Input                 Output
==================================================================
"Code"       ---->   "CCoCodCode"
"name"       ---->   "nnanamname"
"harambe"    ---->   "hhaharharaharamharambharambe"
"sp aces?"   ---->   "sspsp sp asp acsp acesp acessp aces?"
"1234"       ---->   "1121231234"
"ss"         ---->   "sss"
</code>```

This is code golf so shortest code wins + up votes for interesting uses of your respective language.

Good luck!

Body:
Gema, 16 characters

?=@append{s;?}$s

Sample run:

bash-4.3$ echo -n 'sp aces?' | gema '?=@append{s;?}$s'
sspsp sp asp acsp acesp acessp aces?


Title: Simulate a Rubik's cube

Body:
A Rubik's cube has 6 colors: red, orange, yellow, white, blue, and green. Red and orange, yellow and white, and blue and green faces are on opposite sides.

Net of a solved Rubik's cube looks like this:

```<code> Y
BRGO
 W
</code>```

And the tiles look like this:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
B B B R R R G G G O O O
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Challenge

Given rotations, reversed rotations, or double rotations output what a solved cube will transform to, as ASCII art or as an image (whitespaces aren't necessary, may or may not exist, trailing whitespaces are allowed.).

Input will be rotation (and optional modifier). Rotation notation goes like: U(p), L(eft), F(ront), R(ight), B(ack), D(own); 2 (double), ' or i (inverse).

All normal rotations will be 90° clockwise, inverse ones will be counterclockwise.

Explanation about clockwiseness: Imagine the cube as you're looking at the red face, and the yellow face is at the top. Then rotate the cube so that the face that the program will rotate will face you. This is the way clockwiseness will work. (Except back face, you will rotate the cube horizontally in that case.)

Input

Input will be a list of moves.

Output

An ASCII art that represents the cube or an image of the net of the cube.

Examples

Input:  (empty)

Output:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
B B B R R R G G G O O O
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Input: U (up)

Output:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
R R R G G G O O O B B B
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Input: U' or Ui (inverse up)

Output:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
O O O B B B R R R G G G
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Input: U2 (double up)

Output:

```<code>      Y Y Y
      Y Y Y
      Y Y Y
G G G O O O B B B R R R
B B B R R R G G G O O O
B B B R R R G G G O O O
      W W W
      W W W
      W W W
</code>```

Input: L' (inversed left)

Output:

```<code>      R Y Y
      R Y Y
      R Y Y
B B B W R R G G G O O Y
B B B W R R G G G O O Y
B B B W R R G G G O O Y
      O W W
      O W W
      O W W
</code>```

Input: R (right)

Output:

```<code>      Y Y R
      Y Y R
      Y Y R
B B B R R W G G G Y O O
B B B R R W G G G Y O O
B B B R R W G G G Y O O
      W W O
      W W O
      W W O
</code>```

Input: U2 L' D (double up, inverse left, down)

Output:

```<code>      O Y Y
      R Y Y
      R Y Y
G B B W O O B B B R R Y
G B B W R R G G G O O Y
O O Y G B B W R R G G G
      R O O
      W W W
      W W W
</code>```

Rules

No loopholes allowed.

This is code-golf, so shortest code in bytes solving the problem wins.

Body:
Javascript (ES5), 1615 bytes

function m(a){b=[];b[0]=a[6];b[2]=a[0];b[8]=a[2];b[6]=a[8];b[1]=a[3];b[5]=a[1];b[7]=a[5];b[3]=a[7];b[4]=a[4];return b}function q(a,b){c=[];c[0]=b[0];c[1]=b[1];c[2]=a[2];c[3]=b[3];c[4]=b[4];c[5]=a[5];c[6]=b[6];c[7]=b[7];c[8]=a[8];return c}function r(a){var b=[];b[0]=m(a[0]);b[1]=q(a[2],a[1]);b[4]=q(a[1],a[4]);b[3]=q(a[4],a[3]);b[2]=q(a[3],a[2]);b[5]=a[5];return b}function x(a){var b=[];b[0]=m(a[0]);b[1]=a[2];b[2]=a[3];b[3]=a[4];b[4]=a[1];b[5]=m(m(m(a[5])));return b}function y(a){var b=[];b[0]=a[4];b[1]=m(a[1]);b[2]=a[0];b[3]=m(m(m(a[3])));b[4]=a[5];b[5]=a[2];return b}function s(a){a=a.replace(/F2/,"F F");a=a.replace(/R2/,"R R");a=a.replace(/U2/,"U U");a=a.replace(/D2/,"D D");a=a.replace(/B2/,"B B");a=a.replace(/L2/,"L L");a=a.replace(/F'/,"F F F");a=a.replace(/R'/,"R R R");a=a.replace(/U'/,"U U U");a=a.replace(/D'/,"D D D");a=a.replace(/B'/,"B B B");a=a.replace(/L'/,"L L L");a=a.replace(/F/,"y y y R y");a=a.replace(/L/,"y y R y y");a=a.replace(/U/,"x y R y y y x x x");a=a.replace(/B/,"y R y y y");a=a.replace(/D/,"x y y y R y x x x");a=a.split(" ");for(b=["RRRRRRRRR".split(""),"WWWWWWWWW".split(""),"GGGGGGGGG".split(""),"YYYYYYYYY".split(""),"BBBBBBBBB".split(""),"OOOOOOOOO".split("")],c=0;c<a.length;++c)"x"==a[c]?b=x(b):"y"==a[c]?b=y(b):"R"==a[c]&&(b=r(b));return p(b)}function p(a){for(var b="",c=0;3>c;++c)b+="\n   "+a[1][3*c+0]+a[1][3*c+1]+a[1][3*c+2];for(c=0;3>c;++c)b+="\n"+a[5][3*c+0]+a[5][3*c+1]+a[5][3*c+2]+a[2][3*c+0]+a[2][3*c+1]+a[2][3*c+2]+a[0][3*c+0]+a[0][3*c+1]+a[0][3*c+2]+a[4][3*c+0]+a[4][3*c+1]+a[4][3*c+2];for(c=0;3>c;++c)b+="\n   "+a[3][3*c+0]+a[3][3*c+1]+a[3][3*c+2];return b}

Ungolfed:

function m(fac){ //Turn a face
    //0 1 2
    //3 4 5
    //6 7 8

    var fac2=[];
    fac2[0]=fac[6];
    fac2[2]=fac[0];
    fac2[8]=fac[2];
    fac2[6]=fac[8];

    fac2[1]=fac[3];
    fac2[5]=fac[1];
    fac2[7]=fac[5];
    fac2[3]=fac[7];

    fac2[4]=fac[4];

    return fac2;
}

function q(face1,face3){ //Swap right third of two faces
    var face2=[];
    face2[0]=face3[0];
    face2[1]=face3[1];
    face2[2]=face1[2];
    face2[3]=face3[3];
    face2[4]=face3[4];
    face2[5]=face1[5];
    face2[6]=face3[6];
    face2[7]=face3[7];
    face2[8]=face1[8];
    return face2;
}

function r(state){ //Apply a R move
    var state2=[];
    state2[0]=m(state[0]);
    //Swap right set of Front, Up, Back, Down (2,1,4,3);

    state2[1]=q(state[2],state[1]);
    state2[4]=q(state[1],state[4]);
    state2[3]=q(state[4],state[3]);
    state2[2]=q(state[3],state[2]);
    state2[5]=state[5];
    return state2;
}

function x(staten){ //Apply a x move
    var state2=[];
    state2[0]=m(staten[0]);
    state2[1]=staten[2];
    state2[2]=staten[3];
    state2[3]=staten[4];
    state2[4]=staten[1];
    state2[5]=m(m(m(staten[5])));
    return state2;
}

function y(state){ //Apply a y move
    var state2=[];
    state2[0]=state[4];
    state2[1]=m(state[1]);
    state2[2]=state[0];
    state2[3]=m(m(m(state[3])));
    state2[4]=state[5];
    state2[5]=state[2];
    return state2;
}

function s(algo){ //Solve a cube, representing every move with x, y and R
    algo=algo.replace(/F2/,"F F");
    algo=algo.replace(/R2/,"R R");
    algo=algo.replace(/U2/,"U U");
    algo=algo.replace(/D2/,"D D");
    algo=algo.replace(/B2/,"B B");
    algo=algo.replace(/L2/,"L L");

    algo=algo.replace(/F'/,"F F F");
    algo=algo.replace(/R'/,"R R R");
    algo=algo.replace(/U'/,"U U U");
    algo=algo.replace(/D'/,"D D D");
    algo=algo.replace(/B'/,"B B B");
    algo=algo.replace(/L'/,"L L L");

    algo=algo.replace(/F/,"y y y R y");
    algo=algo.replace(/L/,"y y R y y");
    algo=algo.replace(/U/,"x y R y y y x x x");
    algo=algo.replace(/B/,"y R y y y");
    algo=algo.replace(/D/,"x y y y R y x x x");

    algo=algo.split(" ");

    var cstate=[["R","R","R","R","R","R","R","R","R"],["W","W","W","W","W","W","W","W","W"],["G","G","G","G","G","G","G","G","G"],["Y","Y","Y","Y","Y","Y","Y","Y","Y"],["B","B","B","B","B","B","B","B","B"],["O","O","O","O","O","O","O","O","O"]];

    for(var i=0;i<algo.length;++i){
        if(algo[i]=="x"){
            cstate=x(cstate);
        }else if(algo[i]=="y"){
            cstate=y(cstate);
        }else if(algo[i]=="R"){
            cstate=r(cstate);
        }
    }

    return p(cstate);
}

function p(cstate){ //Print
    var out="";
    var leftspace="\n   ";
    for(var i=0;i<3;++i){
        out+=leftspace+cstate[1][3*i+0]+cstate[1][3*i+1]+cstate[1][3*i+2]
    }
    for(var i=0;i<3;++i){
        out+="\n"+cstate[5][3*i+0]+cstate[5][3*i+1]+cstate[5][3*i+2]+cstate[2][3*i+0]+cstate[2][3*i+1]+cstate[2][3*i+2]+cstate[0][3*i+0]+cstate[0][3*i+1]+cstate[0][3*i+2]+cstate[4][3*i+0]+cstate[4][3*i+1]+cstate[4][3*i+2]
    }
    for(var i=0;i<3;++i){
        out+=leftspace+cstate[3][3*i+0]+cstate[3][3*i+1]+cstate[3][3*i+2]
    }
    return out;
}

This was a very difficult challenge.

Explanation

Take the example call s("R U' F").

The program can only execute x, y and R moves.

U' is equal to U U U, so replace that.

F is equal to y y y R y, so replace that.

R U' F' is therefore equal to R U U U y y y R y, which the program can run.

cstate is defined with a solved cube. A cube is represented by an array containing 6 arrays containing the 9 stickers. The first array is for R, second for U, third for F, D, B, last array is for L.
When an y needs to be executed, the program swaps the four arrays of the front, left, back and right face. For an x, it swaps front, down, back and top. Every rotation also rotates the other faces, that were not swapped. A R move rotates the right face and swaps the right part of the front, up, back, down face.

This could be modified to be able to solve problems with all types of moves, by defining them with x, y and R.


答:
Bash on OSX, 13

```<code>jot 11 0 - $1
</code>```

The input is taken as a command-line parameter.  This will also work on Linux is jot is installed; e.g. sudo apt-get install athena-jot.

Title: Print multiplication tables by input

Body:
Bash on OSX, 13

jot 11 0 - $1

The input is taken as a command-line parameter.  This will also work on Linux is jot is installed; e.g. sudo apt-get install athena-jot.


问:
RGB Gradients Generation
The Challenge

Given the two uppercase hexadecimal strings (both 6 characters long, XXXXXX and YYYYYY) representing RGB values (ranging from 000000 to FFFFFF inclusive), and a positive non-zero integer N, display a linear transition of the N+2 colors generated from XXXXXX to YYYYYY that would result in a color gradient.

Example

Input

```<code>FF3762
F08800
9
</code>```

Output

Please note in our example, I've requested 9 interim steps between the two colors, therefore 11 lines will be displayed from initial color to the final color

```<code>FF3762
FD3F58
FC474E
FA4F44
F9573A
F75F31
F66727
F46F1D
F37713
F17F09
F08800
</code>```

Caveats

While I've gone with a simple linear process of deriving the integer values for the interim colors before converting them back into hexadecimal, your methods may vary. Please consider the various ways one could round up/down your numbers accordingly.

Testing

To make this interesting, I've provided a snippet to allow testing of your code, inclusive of a button to provide you with two random colors to test your code against. Displaying your results is optional, but it's encouraged!

c1=()=>('00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6);

$("#col").click(function(){
  alert("Your two colors are: "+c1()+" and "+c1()+".");
});

$("#colors").blur(function(){
  $("#test").empty();
 var colArr = $("#colors").val().split("\n");
 for(c in colArr){
   $("#test").append('
'+colArr[c]+'
')
  }

});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.tester{height: 20px;
width: 60px;padding: 4px;border: 1px solid black;}</code>```

<button id="col">Your two colors</button>

<textarea id="colors"></textarea>

```

1) You can access two random colors for your test by clicking on the "Your two colors" button.
2) The number of interim steps will be the same as the number of characters in your PPCG username inclusive of spaces, in the case of "WallyWest" it would be 9 (as per my example above).
3) Run your code with the two colors and the number and once you have your generated list, you have the option of pasting your output into the textarea and tabbing away from it to get your generated color gradient.

My example is shown here:

I must admit, that looks pretty awesome!

Please note: As I mentioned, showing your testing of your output using the snippet is optional, but it's encouraged! :)

Output

The list output must be in the form of N+2 sets of 6 digit hex numbers separated by line feeds (\n) as shown in my example above. Output can be in the form of separate lines, space/comma separated list, an array or whatever is best suited for your language... (Thanks @nimi for the heads up) Please remember, that if you plan on testing your code with the snippet, however you separate each "color" is up to you.

Rules

This is code-golf, so the shortest solution in bytes will be crowned the winner. No loopholes, naturally. Input must accept the two strings and a number (which as I said will be equivalent to the number of letters in your username on PPCG, thus your resulting output will always be a minimum of three lines long.

答:
PowerShell v2+, <s>176</s> <s>159</s> 150 bytes

```<code>param($a,$b,$n)$x=$a-split'(..)'-ne'';$a;++$n..1|%{$j=$_;-join($x=$x|%{"{0:x2}"-f(+"0x$_"-[int]((+"0x$_"-"0x$(($b-split'(..)'-ne'')[$i++%3])")/$j))})}
</code>```

Takes the input as two strings and a number, then converts the start string into an array of strings split on every two characters, stores that into $x. We then output $a as our starting section, and loop from ++$n to 1 (to ensure proper fenceposting).

Each iteration, sets helper $j to the current number (used later for ensuring we've got the right number of steps between where we're currently at to our destination) and calculates the next step based on a loop through $x.

Each inner loop is just an assignment. We're setting $x at the appropriate place equal to a new string "{0:x2}" using the -format operator. The x2 here specifies a two-digit hexadecimal output, and the input is the right-hand side of the -f operator. PowerShell has a native hexadecimal-to-decimal operator 0x, so this lengthy parens-nested expression is using that operator to  convert the current hex to numbers, subtracting to find the difference yet to go (done by dynamically splitting $b here just like we did to $a, and using modulo to select the right element), dividing by $j steps remaining, casting to an [int] (PowerShell does banker's rounding by default), and subtracting that step-count from the current hex to get what our next hex needs to be.

The result of that calculation is stored back into $x as three hex elements. That's encapsulated in parens to create a copy on the pipeline, and -joined together into a single string. All those resultant strings are left on the pipeline, and output via implicit Write-Output happens at program execution.

Example

I was given 0ba7c5 and 6c0e50 for my two colors, and TimmyD has 6 characters in it.

```<code>PS C:\Tools\Scripts\golfing> .\rgb-gradients-generation.ps1 '0ba7c5' '6c0e50' 6
0ba7c5
1991b4
277ba3
356592
434f82
513971
5f2361
6c0e50
</code>```

Title: RGB Gradients Generation

Body:
PowerShell v2+, <s>176</s> <s>159</s> 150 bytes

param($a,$b,$n)$x=$a-split'(..)'-ne'';$a;++$n..1|%{$j=$_;-join($x=$x|%{"{0:x2}"-f(+"0x$_"-[int]((+"0x$_"-"0x$(($b-split'(..)'-ne'')[$i++%3])")/$j))})}

Takes the input as two strings and a number, then converts the start string into an array of strings split on every two characters, stores that into $x. We then output $a as our starting section, and loop from ++$n to 1 (to ensure proper fenceposting).

Each iteration, sets helper $j to the current number (used later for ensuring we've got the right number of steps between where we're currently at to our destination) and calculates the next step based on a loop through $x.

Each inner loop is just an assignment. We're setting $x at the appropriate place equal to a new string "{0:x2}" using the -format operator. The x2 here specifies a two-digit hexadecimal output, and the input is the right-hand side of the -f operator. PowerShell has a native hexadecimal-to-decimal operator 0x, so this lengthy parens-nested expression is using that operator to  convert the current hex to numbers, subtracting to find the difference yet to go (done by dynamically splitting $b here just like we did to $a, and using modulo to select the right element), dividing by $j steps remaining, casting to an [int] (PowerShell does banker's rounding by default), and subtracting that step-count from the current hex to get what our next hex needs to be.

The result of that calculation is stored back into $x as three hex elements. That's encapsulated in parens to create a copy on the pipeline, and -joined together into a single string. All those resultant strings are left on the pipeline, and output via implicit Write-Output happens at program execution.

Example

I was given 0ba7c5 and 6c0e50 for my two colors, and TimmyD has 6 characters in it.

PS C:\Tools\Scripts\golfing> .\rgb-gradients-generation.ps1 '0ba7c5' '6c0e50' 6
0ba7c5
1991b4
277ba3
356592
434f82
513971
5f2361
6c0e50


答:
PHP <s>40</s> 38 bytes

```<code><?for(;;)echo@~fgetc(STDIN)^~$argv[1];
</code>```

And updated version. Now handles all inputs correctly, and 2 bytes shorter as well.

Sample usage:

```<code>$ more in.dat
This is a test.
This is only a test.

$ php xor-cipher.php A < in.dat > out.dat

$ more out.dat
§)(2a(2a a5$25oK§)(2a(2a./-8a a5$25o

$ php xor-cipher.php A < out.dat
This is a test.
This is only a test.
</code>```

Perl 30 bytes

```<code>$k=pop;s/./print$&^$k/egsfor<>
</code>```

I/O is the same as for the PHP solution above.

Title: Shortest 8-bit xor cipher

Body:
PHP <s>40</s> 38 bytes

<?for(;;)echo@~fgetc(STDIN)^~$argv[1];

And updated version. Now handles all inputs correctly, and 2 bytes shorter as well.

Sample usage:

$ more in.dat
This is a test.
This is only a test.

$ php xor-cipher.php A < in.dat > out.dat

$ more out.dat
§)(2a(2a a5$25oK§)(2a(2a./-8a a5$25o

$ php xor-cipher.php A < out.dat
This is a test.
This is only a test.

Perl 30 bytes

$k=pop;s/./print$&^$k/egsfor<>

I/O is the same as for the PHP solution above.


答:
Pure Bash, 18

```<code>echo $[{0..10}*$1]
</code>```

The input is taken as a command-line parameter.

Title: Print multiplication tables by input

Body:
Pure Bash, 18

echo $[{0..10}*$1]

The input is taken as a command-line parameter.


答:
PHP, <s>39</s> <s>37</s> 35 bytes

```<code>while($c=$argv[1][$i++])echo$s.=$c;
</code>```

works for all examples. String should not countain the 0 character.

PHP, <s>50</s> <s>40</s> 38 bytes

```<code>while(''<$c=$argv[1][$i++])echo$s.=$c;
</code>```

Title: Stringsplode the String!

Body:
PHP, <s>39</s> <s>37</s> 35 bytes

while($c=$argv[1][$i++])echo$s.=$c;

works for all examples. String should not countain the 0 character.

PHP, <s>50</s> <s>40</s> 38 bytes

while(''<$c=$argv[1][$i++])echo$s.=$c;


问:
Are you a Fanatic?
Write a function or program that awards you SE badges. If an input "Q" is given it means you have asked a question. If no input is given it means you have only visited the site.*

Badges it must support:

Run script 30 days in a row: "Enthusiast"

Run script 100 days in a row: "Fanatic"

Input "Q" first time: "Student"

Input "Q" on 5 separate days: "Curious"

Input "Q" on 30 separate days: "Inquisitive"

Input "Q" on 100 separate days: "Socratic"

Input:

You may choose an arbitrary input value for the times you ask questions (I've used "Q" as an example).

You may choose an arbitrary input value, or have none at all, for the times you only visit the site.

If a third type of input is given, say "R", then the counters and list of badges shall be reset. This is to ensure that the program can be reused.

Note, you may visit the site many times each day, and ask several questions on the same day. As with the real badges, days are counted in UTC.

You can only have one of each of the badges.

The source code can be altered, but remember the reset functionality. The score will be the size of the script before it's executed the first time.

Output:

Every time you run the script it should output/print a list of badges you have. The output format is optional, but it must use the proper badge names, i.e. you can't enumerate the badges.

The output should be an empty string, 0, false or something similar if you don't have any badges. The program can't crash, enter an infinite loop or something similar.

This is code golf, so the shortest code before running the script the first time. As always, the score is counted in bytes.

You may use an external file to store information, but both the name of the file, and the size of the file before the code is executed the first time will count toward the score.

答:
I guess I'll start.

JAVA: 572 bytes

```<code>public class a {static Map<Integer,String>o=new HashMap<Integer,String>();static Map<Integer,String>p=new HashMap<Integer,String>();public static void main(String[] args){Scanner d= new Scanner(System.in);b();int e=0,v=0;while(true){char y=d.nextLine().toCharArray()[0];if(y=='Q'){e++;v++;}else if(y == 'R'){e=0;v=0;b();}else{v++;}System.out.println(o.get(v)+p.get(e));o.remove(v);p.remove(e);}}public static void b(){o.clear();p.clear();o.put(30,"Enthusiast");o.put(100, "fanatic");p.put(1, "student");p.put(5, "Curious");p.put(30,"Inquisitive");p.put(100, "Socratic");}}
</code>```

Input:

"R" to reset

"Q" if you asked a question

" " if you visited.

[Enter] to log your day.

Output: The badges that you earned that day.

Title: Are you a Fanatic?

Body:
I guess I'll start.

JAVA: 572 bytes

public class a {static Map<Integer,String>o=new HashMap<Integer,String>();static Map<Integer,String>p=new HashMap<Integer,String>();public static void main(String[] args){Scanner d= new Scanner(System.in);b();int e=0,v=0;while(true){char y=d.nextLine().toCharArray()[0];if(y=='Q'){e++;v++;}else if(y == 'R'){e=0;v=0;b();}else{v++;}System.out.println(o.get(v)+p.get(e));o.remove(v);p.remove(e);}}public static void b(){o.clear();p.clear();o.put(30,"Enthusiast");o.put(100, "fanatic");p.put(1, "student");p.put(5, "Curious");p.put(30,"Inquisitive");p.put(100, "Socratic");}}

Input:

"R" to reset

"Q" if you asked a question

" " if you visited.

[Enter] to log your day.

Output: The badges that you earned that day.


答:
Racket 81 bytes

```<code>(λ(s)(apply string-append(for/list((i(+ 1(string-length s))))(substring s 0 i))))
</code>```

More readable form:

```<code>(define(f s)
  (apply
   string-append
   (for/list
       ((i(+ 1(string-length s))))
     (substring s 0 i))))
</code>```

Testing:

```<code>(f "Code")
"CCoCodCode"
</code>```

Title: Stringsplode the String!

Body:
Racket 81 bytes

(λ(s)(apply string-append(for/list((i(+ 1(string-length s))))(substring s 0 i))))

More readable form:

(define(f s)
  (apply
   string-append
   (for/list
       ((i(+ 1(string-length s))))
     (substring s 0 i))))

Testing:

(f "Code")
"CCoCodCode"


答:
[Groovy] Final Update (199 Bytes) - As per request

Non-golf

```<code>def g(a,b,n){
  (0..(1.0/n)).collect{
    c->
    x={s->s.split("(?<=\\G.{2})").collect{Integer.parseInt(it,16)}};
    (0..2).collect {
      (int)(x(a).get(it)*n*c+x(b).get(it)*(1-n*c))
    }.collect {
      String.format("%X", it)
    }.join()
  }
}
g('FFFFFF','000000',1/10)
</code>```

Golf

```<code>g(a,b,n){(0..(1.0/n)).collect{c->x={s->s.split("(?<=\\G.{2})").collect{Integer.parseInt(it,16)}};(0..2).collect {(int)(x(a).get(it)*n*c+x(b).get(it)*(1-n*c))}.collect{String.format("%X",it)}.join()}}
</code>```

Try the final here:
https://groovyconsole.appspot.com/script/5130696796405760

OLD VERSIONS BELOW, DECLINED BY OP

Groovy (123 Bytes)

Golf

```<code>def g(r,g,b,r2,g2,b2,s){(1..(1.0/s)).collect{c->[(int)(r*s*c+r2*(1-s*c)),(int)(g*s*c+g2*(1-s*c)),(int)(b*s*c+b2*(1-s*c))]}}
</code>```

Non-golf

```<code>def g(r,g,b,r2,g2,b2,s){
  (1..(1.0/s)).collect {
    c ->
    [(int)(r*s*c+r2*(1-s*c)),(int)(g*s*c+g2*(1-s*c)),(int)(b*s*c+b2*(1-s*c))]
  }
}
</code>```

Inputs

```<code>r,g,b -> Starting RGB Color
r2,g2,b2 -> Ending RGB Color
s -> Gradient step
</code>```

Output Example

```<code>(00,00,00,255,255,255,.5)
</code>```

results in

```<code>[
  [255, 255, 255]
  [127, 127, 127]
  [0, 0, 0]
]
</code>```

Try it yourself:
https://groovyconsole.appspot.com/script/5184465357766656

With Hex Conversions Included

Guess I'm kind of cheating as well... Here's the script with using hex:

New code with hex conversions:

```<code>    def g(r,g,b,r2,g2,b2,s){
      (0..(1.0/s)).collect {
        c ->
        String.format("%X", ((int)(r*s*c+r2*(1-s*c)))) +  String.format("%X", ((int)(g*s*c+g2*(1-s*c)))) + "" +  String.format("%X", ((int)(b*s*c+b2*(1-s*c))))
      }
    }

    g(126,34,166,218,26,33,0.0625)
</code>```

188 characters when golfed:

```<code>def g(r,g,b,r2,g2,b2,s){(0..(1.0/s)).collect {c->String.format("%X",((int)(r*s*c+r2*(1-s*c))))+String.format("%X",((int)(g*s*c+g2*(1-s*c))))+String.format("%X",((int)(b*s*c+b2*(1-s*c))))}}
</code>```

Output for 000000 to FFFFFF and 16 (Username Length)

```<code>g(00,00,00,255,255,255,0.0625).each{println it}
</code>```

Title: RGB Gradients Generation

Body:
The Challenge

Given the two uppercase hexadecimal strings (both 6 characters long, XXXXXX and YYYYYY) representing RGB values (ranging from 000000 to FFFFFF inclusive), and a positive non-zero integer N, display a linear transition of the N+2 colors generated from XXXXXX to YYYYYY that would result in a color gradient.

Example

Input

```<code>FF3762
F08800
9
</code>```

Output

Please note in our example, I've requested 9 interim steps between the two colors, therefore 11 lines will be displayed from initial color to the final color

```<code>FF3762
FD3F58
FC474E
FA4F44
F9573A
F75F31
F66727
F46F1D
F37713
F17F09
F08800
</code>```

Caveats

While I've gone with a simple linear process of deriving the integer values for the interim colors before converting them back into hexadecimal, your methods may vary. Please consider the various ways one could round up/down your numbers accordingly.

Testing

To make this interesting, I've provided a snippet to allow testing of your code, inclusive of a button to provide you with two random colors to test your code against. Displaying your results is optional, but it's encouraged!

c1=()=>('00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6);

$("#col").click(function(){
  alert("Your two colors are: "+c1()+" and "+c1()+".");
});

$("#colors").blur(function(){
  $("#test").empty();
 var colArr = $("#colors").val().split("\n");
 for(c in colArr){
   $("#test").append('
'+colArr[c]+'
')
  }

});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.tester{height: 20px;
width: 60px;padding: 4px;border: 1px solid black;}</code>```

<button id="col">Your two colors</button>

<textarea id="colors"></textarea>

```

1) You can access two random colors for your test by clicking on the "Your two colors" button.
2) The number of interim steps will be the same as the number of characters in your PPCG username inclusive of spaces, in the case of "WallyWest" it would be 9 (as per my example above).
3) Run your code with the two colors and the number and once you have your generated list, you have the option of pasting your output into the textarea and tabbing away from it to get your generated color gradient.

My example is shown here:

I must admit, that looks pretty awesome!

Please note: As I mentioned, showing your testing of your output using the snippet is optional, but it's encouraged! :)

Output

The list output must be in the form of N+2 sets of 6 digit hex numbers separated by line feeds (\n) as shown in my example above. Output can be in the form of separate lines, space/comma separated list, an array or whatever is best suited for your language... (Thanks @nimi for the heads up) Please remember, that if you plan on testing your code with the snippet, however you separate each "color" is up to you.

Rules

This is code-golf, so the shortest solution in bytes will be crowned the winner. No loopholes, naturally. Input must accept the two strings and a number (which as I said will be equivalent to the number of letters in your username on PPCG, thus your resulting output will always be a minimum of three lines long.

Body:
[Groovy] Final Update (199 Bytes) - As per request

Non-golf

def g(a,b,n){
  (0..(1.0/n)).collect{
    c->
    x={s->s.split("(?<=\\G.{2})").collect{Integer.parseInt(it,16)}};
    (0..2).collect {
      (int)(x(a).get(it)*n*c+x(b).get(it)*(1-n*c))
    }.collect {
      String.format("%X", it)
    }.join()
  }
}
g('FFFFFF','000000',1/10)

Golf

g(a,b,n){(0..(1.0/n)).collect{c->x={s->s.split("(?<=\\G.{2})").collect{Integer.parseInt(it,16)}};(0..2).collect {(int)(x(a).get(it)*n*c+x(b).get(it)*(1-n*c))}.collect{String.format("%X",it)}.join()}}

Try the final here:
https://groovyconsole.appspot.com/script/5130696796405760

OLD VERSIONS BELOW, DECLINED BY OP

Groovy (123 Bytes)

Golf

def g(r,g,b,r2,g2,b2,s){(1..(1.0/s)).collect{c->[(int)(r*s*c+r2*(1-s*c)),(int)(g*s*c+g2*(1-s*c)),(int)(b*s*c+b2*(1-s*c))]}}

Non-golf

def g(r,g,b,r2,g2,b2,s){
  (1..(1.0/s)).collect {
    c ->
    [(int)(r*s*c+r2*(1-s*c)),(int)(g*s*c+g2*(1-s*c)),(int)(b*s*c+b2*(1-s*c))]
  }
}

Inputs

r,g,b -> Starting RGB Color
r2,g2,b2 -> Ending RGB Color
s -> Gradient step

Output Example

(00,00,00,255,255,255,.5)

results in

[
  [255, 255, 255]
  [127, 127, 127]
  [0, 0, 0]
]

Try it yourself:
https://groovyconsole.appspot.com/script/5184465357766656

With Hex Conversions Included

Guess I'm kind of cheating as well... Here's the script with using hex:

New code with hex conversions:

    def g(r,g,b,r2,g2,b2,s){
      (0..(1.0/s)).collect {
        c ->
        String.format("%X", ((int)(r*s*c+r2*(1-s*c)))) +  String.format("%X", ((int)(g*s*c+g2*(1-s*c)))) + "" +  String.format("%X", ((int)(b*s*c+b2*(1-s*c))))
      }
    }

    g(126,34,166,218,26,33,0.0625)

188 characters when golfed:

def g(r,g,b,r2,g2,b2,s){(0..(1.0/s)).collect {c->String.format("%X",((int)(r*s*c+r2*(1-s*c))))+String.format("%X",((int)(g*s*c+g2*(1-s*c))))+String.format("%X",((int)(b*s*c+b2*(1-s*c))))}}

Output for 000000 to FFFFFF and 16 (Username Length)

g(00,00,00,255,255,255,0.0625).each{println it}


答:
JavaScript (ES6), <s>33</s> 31 bytes

```<code>f=(x,i=11)=>--i&&f(x,i)+" "+x*i
</code>```

It's a recursive solution.

Title: Print multiplication tables by input

Body:
JavaScript (ES6), <s>33</s> 31 bytes

f=(x,i=11)=>--i&&f(x,i)+" "+x*i

It's a recursive solution.


答:
CJam, 11 bytes

```<code>q{(L\+:Lo}h
</code>```

Explanation:

```<code>q                   get input
 {       }h         do while
  (L                get 1st character and variable L (initialized with "")
    \+              swap and concatenate them
      :Lo           store result in L and print it
</code>```

Try it online

Title: Stringsplode the String!

Body:
CJam, 11 bytes

q{(L\+:Lo}h

Explanation:

q                   get input
 {       }h         do while
  (L                get 1st character and variable L (initialized with "")
    \+              swap and concatenate them
      :Lo           store result in L and print it

Try it online


问:
Noah's (upgraded) ark
As preparation for the nth Exodus, Noah decides to write a program that will decide If he will let animals on his ark.  However, Noah wants to go back to grass roots. Thus he decides that the program should be as small and as simple as possible.

GOAL:

Recreate the Contrabulous Choosematron, in a way that follows evangelical stories.

INPUT:

The program is simple, and elegant, and takes in 2 inputs:

The species of animal [String]

and The animal's gender [boolean]

OUTPUT:

The program then puts out Either 'Y' or 'N', Which determines whether or not the given  animal is allowed onto the ark.

RULES:

Only one Animal of each species and gender is allowed on the ark. No more.

Your output can be any set of boolean values (true false, yes no, y n, yin yang) so long as they're easily distinguishable.

If your program should want to accept a list of input, rather than use STDIN, that's fine. However, each output has to be in corresponding order of the input (FIFO), as well as be in the exact same format as the input.

This is a golf, so the lowest byte count wins, good luck!!!!

EXAMPLE:

"Monkey" true<

y

"Monkey" false<

y

"Monkey" false<

n

"Monkey with symbols" false<

y

"monkey" true<

n

This is valid, as your program doesn't need to distinguish that Monkey, and monkey with symbols are the same thing species, however, Monkey and monkey are very much the same thing, and so the last critter would be denied.

答:
Python 2, 72 bytes

Takes input as a list of strings of the form "animalname T". The idea is it just uses each string as an identifier and should only print true if the string has not occurred in the list so far.

```<code>def f(l):k=map(str.lower,l);print[j not in k[:i]for i,j in enumerate(k)]
</code>```

Try it here!

Title: Noah's (upgraded) ark

Body:
Python 2, 72 bytes

Takes input as a list of strings of the form "animalname T". The idea is it just uses each string as an identifier and should only print true if the string has not occurred in the list so far.

def f(l):k=map(str.lower,l);print[j not in k[:i]for i,j in enumerate(k)]

Try it here!