问:
Computer Generated Cracked Soil
Write a program that takes in an integer from 0 to 65535 (216-1) and generates a unique 500×500 pixel image that looks as similar as possible to these 6 real life images of cracked soil:

These are thumbnails, click them to see the full-size 500×500 images.

The goal here is to make your computer generated images as photorealistic as possible. So ideally, if any of the images output by your program were mixed in with the 6 images above, someone seeing the images for the first time would not be able to tell the computer generated ones apart from the real ones.

Perfect photorealism is tricky however, so just do the best you can. This is a popularity-contest so the answers that have more realistic outputs will be upvoted more and be more likely to win.

Rules

You may use image processing functions or libraries.

You may base your algorithm on information gathered from the 6 sample images, but your 65536 (216) possible output images should be visually distinct from each other and the sample images, especially with regard to the arrangement of the cracks. You must truly generate your images, don't just rotate and translate a selection from a preexisting photo.

You should not otherwise hardcode your outputs. A generic algorithm should be used and numbers larger than 65535 should theoretically produce valid outputs. (I've restricted it merely to accommodate small-maximum integer types.)

The input integer can be thought of as a seed that results in a random cracked soil output image. It should be deterministic though, so the same input should always result in the same output.

The output images must be exactly 500×500 pixels.

The output images may be saved in any common image file format, or simply displayed.

Be sure to include a few example output images in your answer, and their corresponding input numbers.

The answer with the most votes wins. Voters should of course upvote answers that attempt to produce images similar to the 6 samples, and downvote answers that break rules or give inconsistent results.

The 6 sample images were taken from texturelib.com. 1000×1000 pixel area selections were taken from two larger images of cracked soil and then resized to 500×500. You may use analysis from these larger images in your program but the output should specifically imitate the 6 chosen sample images.

答:
Python 3 (using Kivy library and GLSL)

First generated image

Python code:

```<code>import os
os.environ['KIVY_NO_ARGS'] = '1'

from kivy.config import Config
Config.set('input','mouse','mouse,disable_multitouch')
Config.set('graphics', 'width', '500')
Config.set('graphics', 'height', '500')
Config.set('graphics', 'resizable', '0')
Config.set('graphics', 'borderless', '1')
Config.set('graphics', 'fbo', 'force-hardware')

from kivy.app import App
from kivy.graphics import RenderContext, Fbo, Color, Rectangle
from kivy.clock import Clock
from kivy.uix.floatlayout import FloatLayout
from kivy.factory import Factory
from kivy.core.window import Window

class ShaderSurface(FloatLayout):
    seed = 0.

    def __init__(self, **kwargs):
        self.canvas = RenderContext(use_parent_projection=True, use_parent_modelview=True)
        with self.canvas:
            self.fbo = Fbo(size=Window.size, use_parent_projection=True)

        with self.fbo:
            Color(0,0,0)
            Rectangle(size=Window.size)

        self.texture = self.fbo.texture

        super(ShaderSurface, self).__init__(**kwargs)
        self.keyboard = Window.request_keyboard(self.keyboard_closed, self)
        self.keyboard.bind(on_key_down=self.on_key_down)
        Clock.schedule_once(self.update_shader,-1)

    def keyboard_closed(self):
        self.keyboard.unbind(on_key_down=self.on_key_down)
        self.keyboard = None

    def update_shader(self, dt=0.):
        self.canvas['resolution'] = list(map(float, self.size))
        self.canvas['seed'] = self.seed
        self.canvas.ask_update()

    def on_key_down(self, keyboard, keycode, text, modifiers):
        if keycode[1] == 'spacebar':
            self.seed += 1.
            self.update_shader()
            Window.screenshot()

Factory.register('ShaderSurface', cls=ShaderSurface)

class RendererApp(App):
    def build(self):
        self.root.canvas.shader.source = 'cracks_sub.glsl'

if __name__ == '__main__':
    RendererApp().run()
</code>```

KV file:

```<code>#:kivy 1.9

ShaderSurface:
    canvas:
        Color:
            rgb: 1, 1, 1
        Rectangle:
            size: self.size
            pos: self.pos
            texture: root.fbo.texture
</code>```

GLSL code:

```<code>---VERTEX---
uniform vec2        resolution;
in vec2             vPosition;

void main()
{
    gl_Position = vec4(vPosition.xy-resolution/2., 0, 1);
}
---FRAGMENT---
#version 330
precision highp float;

out vec4 frag_color;

uniform vec2 resolution;
uniform float seed;

vec2 tr(vec2 p)
{
    p /= resolution.xy;
    p = -1.0+2.0*p;
    p.y *= resolution.y/resolution.x;
    return p;
}

float hash( float n ){
    return fract(sin(n)*43758.5453);
}

float noise( vec2 uv ){
    vec3 x = vec3(uv, 0);

    vec3 p = floor(x);
    vec3 f = fract(x);

    f       = f*f*(3.0-2.0*f);
    float n = p.x + p.y*57.0 + 113.0*p.z;

    return mix(mix(mix( hash(n+0.0), hash(n+1.0),f.x),
                   mix( hash(n+57.0), hash(n+58.0),f.x),f.y),
               mix(mix( hash(n+113.0), hash(n+114.0),f.x),
                   mix( hash(n+170.0), hash(n+171.0),f.x),f.y),f.z);
}

mat2 m = mat2(0.8,0.6,-0.6,0.8);

float fbm(vec2 p)
{
    float f = 0.0;
    f += 0.5000*noise( p ); p*=m*2.02;
    f += 0.2500*noise( p ); p*=m*2.03;
    f += 0.1250*noise( p ); p*=m*2.01;
    f += 0.0625*noise( p );
    f /= 0.9375;
    return f;
}

vec2 hash2( vec2 p )
{
    return fract(sin(vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))))*43758.5453);
}

float voronoi(vec2 x, out vec2 rt)
{
    vec2 p = floor(x);
    vec2 f = fract(x);

    vec2 mb, mr;

    float res = 8.0;
    for( int j=-1; j<=1; j++)
    for( int i=-1; i<=1; i++)
    {
        vec2 b = vec2(float(i),float(j));
        vec2 r = b+hash2(p+b)-f;
        float d = dot(r,r);

        if( d<res )
        {
            res = d;
            mr = r;
            mb = b;
            rt=r;
        }
    }

    res = 8.0;
    for( int j=-2; j<=2; j++ )
    for( int i=-2; i<=2; i++ )
    {
        vec2 b = mb + vec2(float(i),float(j));
        vec2 r = b + hash2(p+b)-f;
        float d = dot((res*res)*(mr+r),normalize(r-mr));

        res = min(res,d);
    }

    return res;
}

float crack(vec2 p)
{
    float g = mod(seed,65536./4.);
    p.x+=g;
    p.y-=seed-g;
    p.y*=1.3;
    p.x+=noise(p*4.)*.08;
    float k = 0.;
    vec2 rb = vec2(.0);
    k=voronoi(p*2.,rb);
    k=smoothstep(.0,.3,k*.05);
    float v = 0.;
    v=voronoi(rb*4.,rb);
    v=smoothstep(.0,.5,v*.05);
    k*=v;
    k-=fbm(p*128.)*.3;
    return k;
}

void main( void )
{
    vec2 fc = gl_FragCoord.xy;
    vec2 p = tr(fc);
    vec3 col = vec3(.39,.37,.25);

    vec3 abb = vec3(.14,.12,.10)/5.;

    p*=(1.+length(p)*.1);

    col.r*=crack(vec2(p.x+abb.x,p.y));
    col.g*=crack(vec2(p.x+abb.y,p.y));
    col.b*=crack(vec2(p.x+abb.z,p.y));

    col*=smoothstep(4.,1.2,dot(p,p));
    col*=exp(.66);

    //col=vec3(crack(p));
    frag_color = vec4(col,1.);
}
</code>```

The voronoi function in the GLSL code is from Íñigo Quílez. Every voronoi related calculation happens in the fragment shader entirely with some procedural noise functions to create speckles and to disturb the lines of the voronoi pattern a bit.

By pressing space the seed will be increased by 1 and a new image will be generated and saved as a .png file.

Update: Added lense distortion, vignetting and chromatic aberration to make it more photo-realistic. Added sub-voronoi pattern.

Title: Computer Generated Cracked Soil

Body:
Python 3 (using Kivy library and GLSL)

First generated image

Python code:

import os
os.environ['KIVY_NO_ARGS'] = '1'

from kivy.config import Config
Config.set('input','mouse','mouse,disable_multitouch')
Config.set('graphics', 'width', '500')
Config.set('graphics', 'height', '500')
Config.set('graphics', 'resizable', '0')
Config.set('graphics', 'borderless', '1')
Config.set('graphics', 'fbo', 'force-hardware')

from kivy.app import App
from kivy.graphics import RenderContext, Fbo, Color, Rectangle
from kivy.clock import Clock
from kivy.uix.floatlayout import FloatLayout
from kivy.factory import Factory
from kivy.core.window import Window

class ShaderSurface(FloatLayout):
    seed = 0.

    def __init__(self, **kwargs):
        self.canvas = RenderContext(use_parent_projection=True, use_parent_modelview=True)
        with self.canvas:
            self.fbo = Fbo(size=Window.size, use_parent_projection=True)

        with self.fbo:
            Color(0,0,0)
            Rectangle(size=Window.size)

        self.texture = self.fbo.texture

        super(ShaderSurface, self).__init__(**kwargs)
        self.keyboard = Window.request_keyboard(self.keyboard_closed, self)
        self.keyboard.bind(on_key_down=self.on_key_down)
        Clock.schedule_once(self.update_shader,-1)

    def keyboard_closed(self):
        self.keyboard.unbind(on_key_down=self.on_key_down)
        self.keyboard = None

    def update_shader(self, dt=0.):
        self.canvas['resolution'] = list(map(float, self.size))
        self.canvas['seed'] = self.seed
        self.canvas.ask_update()

    def on_key_down(self, keyboard, keycode, text, modifiers):
        if keycode[1] == 'spacebar':
            self.seed += 1.
            self.update_shader()
            Window.screenshot()

Factory.register('ShaderSurface', cls=ShaderSurface)

class RendererApp(App):
    def build(self):
        self.root.canvas.shader.source = 'cracks_sub.glsl'

if __name__ == '__main__':
    RendererApp().run()

KV file:

#:kivy 1.9

ShaderSurface:
    canvas:
        Color:
            rgb: 1, 1, 1
        Rectangle:
            size: self.size
            pos: self.pos
            texture: root.fbo.texture

GLSL code:

---VERTEX---
uniform vec2        resolution;
in vec2             vPosition;

void main()
{
    gl_Position = vec4(vPosition.xy-resolution/2., 0, 1);
}
---FRAGMENT---
#version 330
precision highp float;

out vec4 frag_color;

uniform vec2 resolution;
uniform float seed;

vec2 tr(vec2 p)
{
    p /= resolution.xy;
    p = -1.0+2.0*p;
    p.y *= resolution.y/resolution.x;
    return p;
}

float hash( float n ){
    return fract(sin(n)*43758.5453);
}

float noise( vec2 uv ){
    vec3 x = vec3(uv, 0);

    vec3 p = floor(x);
    vec3 f = fract(x);

    f       = f*f*(3.0-2.0*f);
    float n = p.x + p.y*57.0 + 113.0*p.z;

    return mix(mix(mix( hash(n+0.0), hash(n+1.0),f.x),
                   mix( hash(n+57.0), hash(n+58.0),f.x),f.y),
               mix(mix( hash(n+113.0), hash(n+114.0),f.x),
                   mix( hash(n+170.0), hash(n+171.0),f.x),f.y),f.z);
}

mat2 m = mat2(0.8,0.6,-0.6,0.8);

float fbm(vec2 p)
{
    float f = 0.0;
    f += 0.5000*noise( p ); p*=m*2.02;
    f += 0.2500*noise( p ); p*=m*2.03;
    f += 0.1250*noise( p ); p*=m*2.01;
    f += 0.0625*noise( p );
    f /= 0.9375;
    return f;
}

vec2 hash2( vec2 p )
{
    return fract(sin(vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))))*43758.5453);
}

float voronoi(vec2 x, out vec2 rt)
{
    vec2 p = floor(x);
    vec2 f = fract(x);

    vec2 mb, mr;

    float res = 8.0;
    for( int j=-1; j<=1; j++)
    for( int i=-1; i<=1; i++)
    {
        vec2 b = vec2(float(i),float(j));
        vec2 r = b+hash2(p+b)-f;
        float d = dot(r,r);

        if( d<res )
        {
            res = d;
            mr = r;
            mb = b;
            rt=r;
        }
    }

    res = 8.0;
    for( int j=-2; j<=2; j++ )
    for( int i=-2; i<=2; i++ )
    {
        vec2 b = mb + vec2(float(i),float(j));
        vec2 r = b + hash2(p+b)-f;
        float d = dot((res*res)*(mr+r),normalize(r-mr));

        res = min(res,d);
    }

    return res;
}

float crack(vec2 p)
{
    float g = mod(seed,65536./4.);
    p.x+=g;
    p.y-=seed-g;
    p.y*=1.3;
    p.x+=noise(p*4.)*.08;
    float k = 0.;
    vec2 rb = vec2(.0);
    k=voronoi(p*2.,rb);
    k=smoothstep(.0,.3,k*.05);
    float v = 0.;
    v=voronoi(rb*4.,rb);
    v=smoothstep(.0,.5,v*.05);
    k*=v;
    k-=fbm(p*128.)*.3;
    return k;
}

void main( void )
{
    vec2 fc = gl_FragCoord.xy;
    vec2 p = tr(fc);
    vec3 col = vec3(.39,.37,.25);

    vec3 abb = vec3(.14,.12,.10)/5.;

    p*=(1.+length(p)*.1);

    col.r*=crack(vec2(p.x+abb.x,p.y));
    col.g*=crack(vec2(p.x+abb.y,p.y));
    col.b*=crack(vec2(p.x+abb.z,p.y));

    col*=smoothstep(4.,1.2,dot(p,p));
    col*=exp(.66);

    //col=vec3(crack(p));
    frag_color = vec4(col,1.);
}

The voronoi function in the GLSL code is from Íñigo Quílez. Every voronoi related calculation happens in the fragment shader entirely with some procedural noise functions to create speckles and to disturb the lines of the voronoi pattern a bit.

By pressing space the seed will be increased by 1 and a new image will be generated and saved as a .png file.

Update: Added lense distortion, vignetting and chromatic aberration to make it more photo-realistic. Added sub-voronoi pattern.


答:
APL, 32 31 chars

```<code>{⍺=0:(⍴⍵)⍴1⍨1+≢⍵⋄+.×⍨⍣(⍺-1)⊣⍵}
</code>```

Left argument the power to raise to, right argument the matrix. The hardest (most space consuming) bit is building the identity matrix for the case where the desired exponent is 0.
The actual computation is based on the fact that the generalised inner product (.) with + and × as operands is effectively the matrix product. This combined with the power ⍣ operator ("repeat") forms the meat of the solution.

ContentLicense: CC BY-SA 3.0

Title: Find the Matrix Power

Body:
Problem

Create a program or function that can calculate the result of a matrix raised to the nth power. Your code will take an arbitrary square matrix A and a non-negative integer n, and return a matrix with the value An.

Restrictions

Built-in functions that compute the matrix power and matrix product are not allowed.

The rest of the standard rules for code-golf apply.

Explanation

Given a square matrix A, the value of An = A A ⋯ A (repeated matrix product of A with itself, n times). If n is positive, the standard just mentioned is used. When n is zero, the identity matrix with the same order of A is the result.

Goal

This is code-golf and the shortest code wins.

Test Cases

Here, A is the input matrix, n is the input integer, and r is the output matrix where r = An.

```<code>n = 0
A = 62 72
    10 34
r =  1  0
     0  1

n = 1
A = 23 61 47
    81 11 60
    42  9  0
r = 23 61 47
    81 11 60
    42  9  0

n = 2
A =  12  28 -26  3
     -3 -10 -13  0
     25  41   3 -4
    -20 -14  -4 29
r = -650 -1052  -766 227
    -331  -517   169  43
     332   469 -1158 -53
    -878  -990   574 797

n = 4
A = -42 -19  18 -38
    -33  26 -13  31
    -43  25 -48  28
     34 -26  19 -48
r = -14606833  3168904 -6745178  4491946
      1559282  3713073 -4130758  7251116
      8097114  5970846 -5242241 12543582
     -5844034 -4491274  4274336 -9196467

n = 5
A =  7  0 -3  8 -5  6 -6
     6  7  1  2  6 -3  2
     7  8  0  0 -8  5  2
     3  0  1  2  4 -3  4
     2  4 -1 -7 -4 -1 -8
    -3  8 -9 -2  7 -4 -8
    -4 -5 -1  0  5  5 -1
r =  39557  24398 -75256 131769  50575   14153  -7324
    182127  19109   3586 115176 -23305    9493 -44754
    146840  31906 -23476 190418 -38946   65494  26468
     42010 -21876  41060 -13950 -55148   19290   -406
     44130  34244 -35944  34272  22917  -39987 -54864
      1111  40810 -92324  35831 215711 -117849 -75038
    -70219   8803 -61496   6116  45247   50166   2109
</code>```

Body:
APL, 32 31 chars

{⍺=0:(⍴⍵)⍴1⍨1+≢⍵⋄+.×⍨⍣(⍺-1)⊣⍵}

Left argument the power to raise to, right argument the matrix. The hardest (most space consuming) bit is building the identity matrix for the case where the desired exponent is 0.
The actual computation is based on the fact that the generalised inner product (.) with + and × as operands is effectively the matrix product. This combined with the power ⍣ operator ("repeat") forms the meat of the solution.


问:
I only pay with dollars
As the title -- although discretely -- hints, I only pay with dollars.

The challenge

Write a function/program that takes a string as input, which is a monetary value preceded by a symbol. ex) £4.99. Then, return that same amount converted to USD.

Input

You will get a string as input. It will have the currency symbol followed by a number with two decimal places (which could be .00). There will either be decimal points . and/or commas , separating the number. The following currency symbols will come in the inputs:

Euro: €
Pound Sterling: £
Yuan Renminbi: ¥

Also, there will be a comma or decimal point depending on the currency to separate the 'dollars' from the 'cents':

Euro: #.###,##
Pound Sterling: #,###.##
Yuan Renminbi: #,###.##

Output

You will convert the input from the currency determined by the symbol to USD, rounding to two decimal places. The output will be in the format $#,###.##, and there will of course be more numbers on the left of the output if need be (EDIT: this means that there is an arbitrary number of commas in the output, just like in the input). The currency exchange rate we will be using are below.

You can assume that the input contains a symbol that is only one of the above (€ £ ¥ . ,)--that it is always valid.

Exchange rates

```<code>€1 : $1.10
£1 : $1.37
¥1 : $0.15
</code>```

Examples

```<code>Input:
€1,37
£4.00
¥2,782,122.78

Respective output:
$1.51
$5.48
$417,318.42
</code>```

Final words

If you use one of the above symbols (€, £, ¥), you may count them as 1 byte

This is code golf, so shortest code in bytes wins!

答:
Java 7, <s>240</s> <s>227</s> <s>215</s> <s>211</s> <s>207</s> <s>202</s> <s>199</s> 196 bytes

(201 - 2 bytes because of the rule "If you use one of the above symbols (€, £, ¥), you may count them as 1 byte")

Thanks to @Frozn for saving a lot of bytes.

```<code>String c(String a){int c=a.charAt(0);return java.text.NumberFormat.getCurrencyInstance(java.util.Locale.US).format(new Long(a.substring(1).replaceAll(",|\\.",""))*(c<'¥'?1.37:c>'¥'?1.1:.15)/100);}
</code>```

Ungolfed & test code:

Try it here.

```<code>class Main{
  static String c(String a){
    int c = a.charAt(0);
    return java.text.NumberFormat.getCurrencyInstance(java.util.Locale.US)
        .format(new Long(a.substring(1).replaceAll(",|\\.","")) *
                 (c < '¥'
                   ? 1.37
                   : c > '¥'
                     ? 1.1
                     : .15
                  ) / 100);
  }

  public static void main(String[] a){
    System.out.println(c("€1,37"));
    System.out.println(c("£4.00"));
    System.out.println(c("¥2,782,122.78"));
  }
}
</code>```

Output:

```<code>$1.51
$5.48
$417,318.42
</code>```

Title: I only pay with dollars

Body:
Java 7, <s>240</s> <s>227</s> <s>215</s> <s>211</s> <s>207</s> <s>202</s> <s>199</s> 196 bytes

(201 - 2 bytes because of the rule "If you use one of the above symbols (€, £, ¥), you may count them as 1 byte")

Thanks to @Frozn for saving a lot of bytes.

String c(String a){int c=a.charAt(0);return java.text.NumberFormat.getCurrencyInstance(java.util.Locale.US).format(new Long(a.substring(1).replaceAll(",|\\.",""))*(c<'¥'?1.37:c>'¥'?1.1:.15)/100);}

Ungolfed & test code:

Try it here.

class Main{
  static String c(String a){
    int c = a.charAt(0);
    return java.text.NumberFormat.getCurrencyInstance(java.util.Locale.US)
        .format(new Long(a.substring(1).replaceAll(",|\\.","")) *
                 (c < '¥'
                   ? 1.37
                   : c > '¥'
                     ? 1.1
                     : .15
                  ) / 100);
  }

  public static void main(String[] a){
    System.out.println(c("€1,37"));
    System.out.println(c("£4.00"));
    System.out.println(c("¥2,782,122.78"));
  }
}

Output:

$1.51
$5.48
$417,318.42


答:
Convex, <s>56</s> <s>55</s> 54 bytes

```<code>(\®\.|,"ö)\e_\'.\++~\"€£¥"#[1.1_.27+.15]=*"%,.2f"\Ø'$\
</code>```

Well, this can definitely be shortened. Try it online!

Saved a byte thanks to Lynn!

Explanation to come when I can get access to a computer.

Title: I only pay with dollars

Body:
As the title -- although discretely -- hints, I only pay with dollars.

The challenge

Write a function/program that takes a string as input, which is a monetary value preceded by a symbol. ex) £4.99. Then, return that same amount converted to USD.

Input

You will get a string as input. It will have the currency symbol followed by a number with two decimal places (which could be .00). There will either be decimal points . and/or commas , separating the number. The following currency symbols will come in the inputs:

Euro: €
Pound Sterling: £
Yuan Renminbi: ¥

Also, there will be a comma or decimal point depending on the currency to separate the 'dollars' from the 'cents':

Euro: #.###,##
Pound Sterling: #,###.##
Yuan Renminbi: #,###.##

Output

You will convert the input from the currency determined by the symbol to USD, rounding to two decimal places. The output will be in the format $#,###.##, and there will of course be more numbers on the left of the output if need be (EDIT: this means that there is an arbitrary number of commas in the output, just like in the input). The currency exchange rate we will be using are below.

You can assume that the input contains a symbol that is only one of the above (€ £ ¥ . ,)--that it is always valid.

Exchange rates

```<code>€1 : $1.10
£1 : $1.37
¥1 : $0.15
</code>```

Examples

```<code>Input:
€1,37
£4.00
¥2,782,122.78

Respective output:
$1.51
$5.48
$417,318.42
</code>```

Final words

If you use one of the above symbols (€, £, ¥), you may count them as 1 byte

This is code golf, so shortest code in bytes wins!

Body:
Convex, <s>56</s> <s>55</s> 54 bytes

(\®\.|,"ö)\e_\'.\++~\"€£¥"#[1.1_.27+.15]=*"%,.2f"\Ø'$\

Well, this can definitely be shortened. Try it online!

Saved a byte thanks to Lynn!

Explanation to come when I can get access to a computer.


问:
Generate a Kolakoski sequence

Definition1

A Kolakoski sequence is a self-describing infinite sequence {kn} of alternating blocks of 1's and 2's, given by the following rules:

k0 = 1

kn = the length of the (n+1)'th block

The Task

Given a positive integer n, generate the first n elements of the Kolakoski sequence.

Details

Input will be provided as a single command line argument n. Please write a full program that will print the first n elements of the Kolakoski sequence (in order) to STDOUT, with each element separated by your favorite whitespace.

Scoring

Lets count source code bytes this time with all whitespace included. Fewest number of bytes wins. In the event of a tie, the solution with the earliest submission time wins.

The Sequence2

1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, ...

References

John Smith, Ariel Scolnicov, yark. "Kolakoski sequence" (version 3). PlanetMath.org. Freely available at http://planetmath.org/KolakoskiSequence.html.

The Online Encyclopedia of Integer Sequences http://oeis.org/A000002

Other resources

Kolakoski Sequence at Wikipedia http://en.wikipedia.org/wiki/Kolakoski_sequence

Kolakoski Sequence at Wolfram MathWorld http://mathworld.wolfram.com/KolakoskiSequence.html

答:
GolfScript (48 chars)

You can't test this online because the online GS shell doesn't take command-line arguments, but:

```<code>;"#{ARGV[-1]}"~[1 2.]2{.2$=[1$2%)]*@\+\)}3$*;<n*
</code>```

This takes input from stdin instead and works

```<code>~[1 2.]2{.2$=[1$2%)]*@\+\)}3$*;<n*
</code>```

Title: Generate a Kolakoski sequence

Body:
GolfScript (48 chars)

You can't test this online because the online GS shell doesn't take command-line arguments, but:

;"#{ARGV[-1]}"~[1 2.]2{.2$=[1$2%)]*@\+\)}3$*;<n*

This takes input from stdin instead and works

~[1 2.]2{.2$=[1$2%)]*@\+\)}3$*;<n*


答:
JavaScript (ES6), 107

Simple and straightforward<s>, probably more golfable</s>

Note: tested in FireFox. Many browsers (especially mobile) have buggy support of toLocaleString

a=>(a.replace(/\D/g,'')/1e4*(a<'¥'?137:a>'€'?110:15)).toLocaleString('en',{style:'currency',currency:'USD'})
```
<p><strong>TEST</strong></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function test()
{
  var i=I.value
  var F=a=>(a.replace(/\D/g,'')/1e4*(a<'¥'?137:a>'€'?110:15)).toLocaleString('en',{style:'currency',currency:'USD'})
  O.textContent=F(i)
}

test()</code>```

<input id=I value='¥2,782,122.78' oninput='test()'>

```</code>```

Title: I only pay with dollars

Body:
JavaScript (ES6), 107

Simple and straightforward<s>, probably more golfable</s>

Note: tested in FireFox. Many browsers (especially mobile) have buggy support of toLocaleString

a=>(a.replace(/\D/g,'')/1e4*(a<'¥'?137:a>'€'?110:15)).toLocaleString('en',{style:'currency',currency:'USD'})

TEST

function test()
{
  var i=I.value
  var F=a=>(a.replace(/\D/g,'')/1e4*(a<'¥'?137:a>'€'?110:15)).toLocaleString('en',{style:'currency',currency:'USD'})
  O.textContent=F(i)
}

test()

<input id=I value='¥2,782,122.78' oninput='test()'>
<pre id=O></pre>


问:
The Doughnut Shop™
Being short of cash, you have signed up to build donuts for The Doughnut Shop™, the biggest digital doughnut company in the world, mostly because they sell every size of doughnut imaginable.

Now, given that trading standards nowadays is very tough, you need to write a piece of code as short as possible to create these doughnuts so that the source code that created them can be put on the outside of the packet.

Challenge

Given 4 inputs, radius of the outer ring, radius of the inner ring, the possible sprinkles and the chance of a cell having a sprinkle, output a doughnut covered in those sprinkles which has the correct inner and outer radii.

The input may be taken how you wish (arguments to a function, stdin, program arguments) and in any order.

The sprinkles will be given in the form of 1 character per sprinkle type

^+*- as sprinkle input would be a list of 4 sprinkles, ^, +, *, -

The chance of a sprinkle will be entered as a floating point value between 0 and 1. eg: 0.1, 0.23

You must print out the output to stdout or equivalent.

Sprinkles can't be on the edges of the doughnut.

Each type of sprinkle must have an equally likely chance of being on each cell.

The radii are given in 1-cell units.

If the inner radius equals either 0 OR the outer radius, the doughnut is said to have no ring.

Both radii will be non-negative integers.

The inner and outer edges of the doughnut must be represented using hashes (#)

A test to see if a point is in a circle, given a radius and the center of the circle is:

(x-center)**2+(y-center)**2 < radius**2

Example input with output

(outer radius, inner radius, sprinkles, chance of sprinkle)

10, 4, "^+*-", 0.1

```<code>     #########
    #         #
  ##  ++   *  *##
  #             #
 #       ^^ - *  #
#      #####   ^  #
#+    #     #     #
#    #       #-   #
#    #       #  * #
#    #       #+   #
#    #       #    #
#^  +#       #    #
#     #     #     #
# *    #####      #
 #       +  -    #
  #        ^    #
  ##  ^  +     ##
    #       ^ #
     #########
</code>```

5, 2, ":^+*", 0.9

```<code>  #####
 #^^+ ^#
#**###  #
#:#   #^#
#^#   #*#
#:#   #*#
#:+###* #
 # *:^:#
  #####
</code>```

This is code golf, the shortest answer in bytes wins

答:
Python, 263 bytes

So I saw a challenge with no answers that looked relatively easy but also interesting and thought to myself:

Hmm... If I'm the only one with an answer, I'll be winning until a better answer inevitably shows up.

So I sat down with Python for a few minutes and came up with a rough draft which, with the help of the community's suggestions, I have been tweaking to reduce its size.

```<code>from random import*
def D(O,I,S,P):
 a=range(-O,O+1);C=lambda x,y,z,n:(n-.5)**2<x*x+y*y<(z+.5)**2
 if I>=O:I=0
 for y in a:
  R=''
  for x in a:
   if C(x,y,O,O)+(C(x,y,I,I)&(I!=0)):R+='#'
   elif C(x,y,O,I)&(uniform(0,1)<P):R+=choice(s)
   else:R+=' '
  print(R)
</code>```

For the examples above, this creates

```<code>>>> D(10, 4, "^+*-", 0.1)
       #######
     ##       ##
    #         * #
   #             #
  #          + ^  #
 # +               #
 #   + +#####   -  #
#      ##   ##    ^ #
#     ##     ##  *  #
#-    #       #     #
#     #       #  +  #
# +   #       #     #
#     ##     ##     #
#      ##   ##  *   #
 #+-    #####      #
 #             - - #
  #   -    -     +#
   #      ^      #
    # -    +    #
     ## *     ##
       #######
>>>
</code>```

and

```<code>>>> D(5, 2, ":^+*", 0.9)
   #####
  #*^:* #
 #^::*:^*#
#* :###+*:#
#:*#   #+:#
#::#   #+ #
#+:#   #*:#
#^^:###::^#
 # + :*^ #
  # *:+*#
   #####
>>>
</code>```

I highly doubt that this is the shortest possible solution, but I think it worked out pretty well for a self-taught teenager's attempt to kill time. Since this was designed to be as small as possible, I have not included comments and have taken shortcuts on every variable name and as such, this program is more for usability than readability.

Should you want to use this code for some reason unbeknownst to me, just run it in IDLE and type the command

```<code>D(Outer Radius, Inner Radius, Sprinkles, Chance of Sprinkle)
</code>```

in the format described above.

Title: The Doughnut Shop™

Body:
Python, 263 bytes

So I saw a challenge with no answers that looked relatively easy but also interesting and thought to myself:

Hmm... If I'm the only one with an answer, I'll be winning until a better answer inevitably shows up.

So I sat down with Python for a few minutes and came up with a rough draft which, with the help of the community's suggestions, I have been tweaking to reduce its size.

from random import*
def D(O,I,S,P):
 a=range(-O,O+1);C=lambda x,y,z,n:(n-.5)**2<x*x+y*y<(z+.5)**2
 if I>=O:I=0
 for y in a:
  R=''
  for x in a:
   if C(x,y,O,O)+(C(x,y,I,I)&(I!=0)):R+='#'
   elif C(x,y,O,I)&(uniform(0,1)<P):R+=choice(s)
   else:R+=' '
  print(R)

For the examples above, this creates

>>> D(10, 4, "^+*-", 0.1)
       #######
     ##       ##
    #         * #
   #             #
  #          + ^  #
 # +               #
 #   + +#####   -  #
#      ##   ##    ^ #
#     ##     ##  *  #
#-    #       #     #
#     #       #  +  #
# +   #       #     #
#     ##     ##     #
#      ##   ##  *   #
 #+-    #####      #
 #             - - #
  #   -    -     +#
   #      ^      #
    # -    +    #
     ## *     ##
       #######
>>>

and

>>> D(5, 2, ":^+*", 0.9)
   #####
  #*^:* #
 #^::*:^*#
#* :###+*:#
#:*#   #+:#
#::#   #+ #
#+:#   #*:#
#^^:###::^#
 # + :*^ #
  # *:+*#
   #####
>>>

I highly doubt that this is the shortest possible solution, but I think it worked out pretty well for a self-taught teenager's attempt to kill time. Since this was designed to be as small as possible, I have not included comments and have taken shortcuts on every variable name and as such, this program is more for usability than readability.

Should you want to use this code for some reason unbeknownst to me, just run it in IDLE and type the command

D(Outer Radius, Inner Radius, Sprinkles, Chance of Sprinkle)

in the format described above.


问:
Reverse Polish notation
You must evaluate a string written in Reverse Polish notation and output the result.

The program must accept an input and return the output. For programming languages that do not have functions to receive input/output, you can assume functions like readLine/print.

You are not allowed to use any kind of "eval" in the program.

Numbers and operators are separated by one or more spaces.

You must support at least the +, -, * and / operators.

You need to add support to negative numbers (for example, -4 is not the same thing as 0 4 -) and floating point numbers.

You can assume the input is valid and follows the rules above

Test Cases

Input:

```<code>-4 5 +
</code>```

Output:

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

Input:

```<code>5 2 /
</code>```

Output:

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

Input:

```<code>5 2.5 /
</code>```

Output:

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

Input:

```<code>5 1 2 + 4 * 3 - +
</code>```

Output:

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

Input:

```<code>4 2 5 * + 1 3 2 * + /
</code>```

Output:

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

答:
Mathetmatica, 143 bytes

```<code>Last@Flatten[#~ImportString~"CSV"&/@StringSplit@#]//.{{a___,b_,c_,o_String,d___}:>{a,o[b,c],d},"+"->Plus,"*"->Times,"/"->Divide,"-"->Subtract}&
</code>```

Anonymous function, takes a string as input (StringSplit[#]), splits at whitespace, ImportString[#,"CSV"] acts on each element separately (it's like a soft form of eval), converting number-like strings to numbers, however operators remain as strings.

//. - repeatedly apply replacement rule: go through the input list, until you hit an operator character, e.g. {1, 4, 2, / *} becomes {1 /[4,2] *}, then {*[1, /[4,2]]}.

String-forms of operators are replaced with the names of the actual Mathematica functions which do the required thing. Output is a number.

ContentLicense: CC BY-SA 2.5

Title: Reverse Polish notation

Body:
Mathetmatica, 143 bytes

Last@Flatten[#~ImportString~"CSV"&/@StringSplit@#]//.{{a___,b_,c_,o_String,d___}:>{a,o[b,c],d},"+"->Plus,"*"->Times,"/"->Divide,"-"->Subtract}&

Anonymous function, takes a string as input (StringSplit[#]), splits at whitespace, ImportString[#,"CSV"] acts on each element separately (it's like a soft form of eval), converting number-like strings to numbers, however operators remain as strings.

//. - repeatedly apply replacement rule: go through the input list, until you hit an operator character, e.g. {1, 4, 2, / *} becomes {1 /[4,2] *}, then {*[1, /[4,2]]}.

String-forms of operators are replaced with the names of the actual Mathematica functions which do the required thing. Output is a number.


问:
Forecast Palindromic Dates
Palindromic dates are dates that appear as palindromes: the string of digits can be read the same way backwards as forwards. For the North American date format (MM/DD/YYYY), the next few palindromic dates are:

02/02/2020

12/02/2021

03/02/2030

The Challenge

Create a function that returns all palindromic dates in a consistent, common date format (of your choosing) that fall within a range of dates (edit: including the range itself).

Rules

To qualify as a palindrome, only the numeric characters of the date should be
checked.

The date can be in any common format (MM/DD/YYYY, DD-MM-YYYY), as
long as it uses two digits for both the month and day and four for
the year, and it uses a character to separate parts of the date. The output must preserve seperating characters (/, -, etc.). Your function only needs to handle one distinct date format. Please include the format in your answer.

If there are more than one dates returned, they should be comma or
new-line separated.

Shortest answer wins!

Example

```<code>date_palindrome('05/02/2050', '12/12/2060')
>>>['05/02/2050', '06/02/2060']
</code>```

答:
Oracle 11: SQL:  246 bytes (hey, at least I beat Java :P lol )

```<code>with d as(select to_date('&1','yyyy-mm-dd')s,to_date('&2','yyyy-mm-dd')e from dual),r as(select level-1 l from d connect by level<=e-s+1),x as(select s+l y,to_char(s+l,'yyyymmdd')w from d,r)select to_char(y,'yyyy-mm-dd')from x where w=reverse(w);
</code>```

Output:

```<code>  SQL> with d as(select to_date('&1','yyyy-mm-dd')s,to_date('&2','yyyy-mm-dd')e from dual),r as(select level-1 l from d connect by level<=e-s+1),x as(select s+l y,to_char(s+l,'yyyymmdd')w from d,r)select to_char(y,'yyyy-mm-dd')from x where w=reverse(w);
  Enter value for 1: 2000-01-01
  Enter value for 2: 2021-01-01

  TO_CHAR(Y,
  ----------
  2001-10-02
  2010-01-02
  2011-11-02
  2020-02-02

  SQL>
</code>```

In readable format:

```<code>  with d as (select to_date('&1','yyyy-mm-dd') s,
                    to_date('&2','yyyy-mm-dd') e
              from dual),
        r as (select level-1 l
                from d connect by level <= e-s+1),
        x as (select s+l y, to_char(s+l,'yyyymmdd') w
                from d,r)
  select to_char(y,'yyyy-mm-dd')
    from x
   where w=reverse(w);
</code>```

Explained:

```<code>d: get input for start/end
r: generate rows needed, 1 per day.
x: calculate the actual dates, and convert them to a minimal string.
final: use REVERSE function to verify the palindroms, return in proper format.
</code>```

Learned about the REVERSE function today :)

Title: Forecast Palindromic Dates

Body:
Oracle 11: SQL:  246 bytes (hey, at least I beat Java :P lol )

with d as(select to_date('&1','yyyy-mm-dd')s,to_date('&2','yyyy-mm-dd')e from dual),r as(select level-1 l from d connect by level<=e-s+1),x as(select s+l y,to_char(s+l,'yyyymmdd')w from d,r)select to_char(y,'yyyy-mm-dd')from x where w=reverse(w);

Output:

  SQL> with d as(select to_date('&1','yyyy-mm-dd')s,to_date('&2','yyyy-mm-dd')e from dual),r as(select level-1 l from d connect by level<=e-s+1),x as(select s+l y,to_char(s+l,'yyyymmdd')w from d,r)select to_char(y,'yyyy-mm-dd')from x where w=reverse(w);
  Enter value for 1: 2000-01-01
  Enter value for 2: 2021-01-01

  TO_CHAR(Y,
  ----------
  2001-10-02
  2010-01-02
  2011-11-02
  2020-02-02

  SQL>

In readable format:

  with d as (select to_date('&1','yyyy-mm-dd') s,
                    to_date('&2','yyyy-mm-dd') e
              from dual),
        r as (select level-1 l
                from d connect by level <= e-s+1),
        x as (select s+l y, to_char(s+l,'yyyymmdd') w
                from d,r)
  select to_char(y,'yyyy-mm-dd')
    from x
   where w=reverse(w);

Explained:

d: get input for start/end
r: generate rows needed, 1 per day.
x: calculate the actual dates, and convert them to a minimal string.
final: use REVERSE function to verify the palindroms, return in proper format.

Learned about the REVERSE function today :)


问:
Convert YYYYMM to MMMYY
Basing on this SO question.

Challenge is rather simple: given a date period in the format YYYYMM output it in the format MMMYY.

Rules:

The input will be a number or a string exactly 6 characters long, consisting only of digits.

Last two digits will be between 01 and 12.

Output must be in the form MMMYY, where MMM represents uppercase three-letter code for the month (below) and YY represents two last digits of the YYYY part of the input.

List of months with corresponding code:

```<code>MM    MMM
01    JAN
02    FEB
03    MAR
04    APR
05    MAY
06    JUN
07    JUL
08    AUG
09    SEP
10    OCT
11    NOV
12    DEC
</code>```

Examples:

```<code>Input     Output
201604    APR16
200001    JAN00
000112    DEC01
123405    MAY34
</code>```

答:
Swift 2.2, 149 bytes

```<code>let f = NSDateFormatter(),g = NSDateFormatter();f.dateFormat = "yyyyMM";g.dateFormat = "MMMyy"
g.stringFromDate(f.dateFromString(i)!).uppercaseString
</code>```

Trying to get this shorter than Kotlin...  It's a shame NSDateFormatter doesn't have an initializer that sets its dateFormat.  NSDateFormatter also does not have a default dateFormat value, causing additional losses.

Swift 3, 136 bytes

```<code>let f = DateFormatter(),g = DateFormatter();f.dateFormat = "yyyyMM";g.dateFormat = "MMMyy"
g.string(from: f.date(from: i)!).uppercased()
</code>```

Thanks to the removal of the NS prefix on some classes, I was able to make the Swift 3 answer a little shorter.  Still not shorter than Kotlin though...

Test function and cases:

```<code>import Foundation
import XCTest

func dateConverter(i: String) -> String? {
    let f = DateFormatter(),g = DateFormatter();f.dateFormat = "yyyyMM";g.dateFormat = "MMMyy"

    if let date = f.date(from: i) {
        return g.string(from: date).uppercased()
    }

    return nil
}

XCTAssert(dateConverter(i: "201604") == "APR16")
XCTAssert(dateConverter(i: "200001") == "JAN00")
XCTAssert(dateConverter(i: "000112") == "DEC01")
XCTAssert(dateConverter(i: "123405") == "MAY34")
</code>```

Title: Convert YYYYMM to MMMYY

Body:
Swift 2.2, 149 bytes

let f = NSDateFormatter(),g = NSDateFormatter();f.dateFormat = "yyyyMM";g.dateFormat = "MMMyy"
g.stringFromDate(f.dateFromString(i)!).uppercaseString

Trying to get this shorter than Kotlin...  It's a shame NSDateFormatter doesn't have an initializer that sets its dateFormat.  NSDateFormatter also does not have a default dateFormat value, causing additional losses.

Swift 3, 136 bytes

let f = DateFormatter(),g = DateFormatter();f.dateFormat = "yyyyMM";g.dateFormat = "MMMyy"
g.string(from: f.date(from: i)!).uppercased()

Thanks to the removal of the NS prefix on some classes, I was able to make the Swift 3 answer a little shorter.  Still not shorter than Kotlin though...

Test function and cases:

import Foundation
import XCTest

func dateConverter(i: String) -> String? {
    let f = DateFormatter(),g = DateFormatter();f.dateFormat = "yyyyMM";g.dateFormat = "MMMyy"

    if let date = f.date(from: i) {
        return g.string(from: date).uppercased()
    }

    return nil
}

XCTAssert(dateConverter(i: "201604") == "APR16")
XCTAssert(dateConverter(i: "200001") == "JAN00")
XCTAssert(dateConverter(i: "000112") == "DEC01")
XCTAssert(dateConverter(i: "123405") == "MAY34")


答:
Python 3.6 (pre-release), 87

```<code>lambda s:f"${int(s.translate({46:'',44:''})[1:])*[110,15,0,137][ord(s[0])%4]/1e4:,.2f}"
</code>```

Uses f-strings to evaluate the result and format it.

s.translate({46:'',44:''}) removes dots and commas from s, thus making it a valid int literal, then int(...) converts it into the actual int object.

Title: I only pay with dollars

Body:
Python 3.6 (pre-release), 87

lambda s:f"${int(s.translate({46:'',44:''})[1:])*[110,15,0,137][ord(s[0])%4]/1e4:,.2f}"

Uses f-strings to evaluate the result and format it.

s.translate({46:'',44:''}) removes dots and commas from s, thus making it a valid int literal, then int(...) converts it into the actual int object.


问:
Rube Goldberg Hello World
For this golf, you will need to use more than one language.

The task

A Rube Goldberg machine is a contraption that takes an enormous number of complicated steps in order to execute a very simple task. The goal of this golf is to output Rube Goldberg... but not directly.

The machine

Your "machine" is the source code that, once executed, will give another source code in another language that will output Rube Goldberg upon execution. Got it?

I rephrase: your initial code must give another code, that other code must output Rube Goldberg. Both codes must be written in different languages.

The bonus which is more like the only fun way to do it

There is a bonus if your code outputs a code that will output a code that will ... that will output Rube Goldberg.

NOTE: any sort of output can be used (stdout, stderr, dialog box, ...)

The points

The number of points is equal to the number of bytes used in your code, divided by the number of distinct, extra languages that you used.

NOTE: different languages use different encodings. The number of bytes is counted in the initial language with its own encoding.

Examples

Pyth -> J -> Javascript -> output in 30 bytes = 30/2 = 15 points (J and Javascript are the extra languages)

Java -> C# -> C++ -> PHP -> output in 36 bytes = 36/3 = 12 points (More bytes and more languages can win over fewer bytes and fewer languages (I know there is no way that these languages do it in 36 bytes))

C -> output in 10 bytes = 10/0 = Infinity points (No extra languages)

Python -> Perl -> Ruby -> Python -> Ruby in 44 bytes = 44/2 = 22 points (Perl and Ruby are the extra languages, the second Python is not counted as it is not an extra language, the second Ruby is not counted as it has already been used)

NOTE: Languages that output their input can't be used. That would be an extra language with absolutely no additional bytes.

The answer

Please provide an answer that clearly states which languages you used and shows us the code at each step (i.e.: in each language).

The winner

Of course, like usual, the lowest score wins.

NOTE: As usual, standard loopholes and "cheats" are not allowed.

答:
Python -> Ruby -> Bash -> JS -> /// -> m4, score: 54 / 5 = 10.8

```<code>Original  print"puts\"echo \'alert(\\\"Rube Goldberg#/\\\")'\""
Python    puts"echo 'alert(Rube Goldberg)'"
Ruby      echo 'alert("Rube Goldberg#/")'
Bash      alert("Rube Goldberg#/")
JS        Rube Goldberg#/
///       Rube Goldberg#
m4        Rube Goldberg
</code>```

I've got the /// and m4 trick from the answer https://codegolf.stackexchange.com/a/83627/53416

ContentLicense: CC BY-SA 4.0

Title: Rube Goldberg Hello World

Body:
Python -> Ruby -> Bash -> JS -> /// -> m4, score: 54 / 5 = 10.8

Original  print"puts\"echo \'alert(\\\"Rube Goldberg#/\\\")'\""
Python    puts"echo 'alert(Rube Goldberg)'"
Ruby      echo 'alert("Rube Goldberg#/")'
Bash      alert("Rube Goldberg#/")
JS        Rube Goldberg#/
///       Rube Goldberg#
m4        Rube Goldberg

I've got the /// and m4 trick from the answer https://codegolf.stackexchange.com/a/83627/53416


答:
Pyth - <s>54</s> <s>53</s> <s>48</s> 47 bytes

Forgot about conditional application W.

```<code>.F"${:,.2f}"*v-tXWqhQ\€Q",.")\,@[1.1.15d1.37)Ch
</code>```

Test Suite.

Title: I only pay with dollars

Body:
Pyth - <s>54</s> <s>53</s> <s>48</s> 47 bytes

Forgot about conditional application W.

.F"${:,.2f}"*v-tXWqhQ\€Q",.")\,@[1.1.15d1.37)Ch

Test Suite.


Title: I only pay with dollars

Body:
Python 3.5, <s>137</s> <s>131</s> <s>121</s> <s>120</s> 117 bytes:

(Thanks to Maltysen for a hint on saving 6 bytes (137 -> 131)!)

lambda u:'${:,.2f}'.format(float(u[1:].translate([{44:''},{44:46,46:''}]['€'in u]))*{'€':1.1,'£':1.37,'¥':.15}[u[0]])

Try It Online! (Ideone)


问:
Calculate the nth term of Golomb's self-describing sequence
Inspired by the previous question.

Golomb's self-describing sequence g(n) is a sequence where any natural number n is repeated within the sequence g(n) times.

The first few numbers in the sequence are:

```<code>n    1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20
g(n) 1  2  2  3  3  4  4  4  5  5  5  6  6  6  6  7  7  7  7  8
</code>```

You can see that g(4)=3, and that "4" is repeated 3 times in the sequence.

Given an input of n, output g(n).

Limitations: n < 100000.

Smallest code wins.

Body:
GolfScript (31 chars)

~([1 2.]2{.2$=[1$)]*@\+\)}3$*;=

Demo


问:
Index sum and strip my matrix

Index sum and strip my matrix

Given a matrix/2d array in your preferable language

Input:

The matrix will always have an odd length

The matrix will always be perfectly square

The matrix values can be any integer in your language (positive or negative)

Example:

```<code>1  2  3  4  5  6  7
2  3  4  5  6  7  8
3  4  50 6  7  8  9
4  5  6 100 8  9  10
5  6  7  8 -9  10 11
6  7  8  9  10 11 12
7  8 900 10 11 12 0
</code>```

Definitions:

The "central number" is defined as the number that has the same amount of numbers to the left,right,up and down

In this case its middlemost 100

The "outer shell" is the collection of numbers which their x and y index is or 0 or the matrix size

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

Your task:

Add to the central number the sum of each row and column after multiplying the values in each by their 1-based index

A single row for example

```<code>4  5  6  7  8
</code>```

for each number

```<code>number * index + number * index.....

4*1 + 5*2 + 6*3 + 7*4 + 8*5 => 100
</code>```

example:

```<code> 2 -3 -9  4  7  1  5  => 61
-2  0 -2 -7 -7 -7 -4  => -141
 6 -3 -2 -2 -3  2  1  => -10
 8 -8  4  1 -8  2  0  => -20
-5  6  7 -1  8  4  8  => 144
 1  5  7  8  7 -9 -5  => 10
 7  7 -2  2 -7 -8  0  => -60
                         |
78 65 60 45 -15 -89 10   => 154
                     |
                     => -16
</code>```

For all rows and columns you combine these values..

Now you sum these too => 154-16 = 138

You add that number to the "central number" and remove the "outer shell" of the matrix

```<code> 0 -2 -7 -7 -7     => -88
-3 -2 -2 -3  2     => -15
-8  4 1+138 -8  2  => 395
 6  7 -1  8  4     => 69
 5  7  8  7 -9     => 26

19 69 442 30 -26
</code>```

do this untill you end up with a single number

```<code>-2 -2 -3     => -15
 4  1060 -8  => 2100
 7 -1  8     => 29

27 2115 5
</code>```

Add 2114+2147 to 1060

Remove the "outer shell" and get 5321

Now we have a single number left

this is the output!

test cases:

```<code>-6

-6
</code>```

```<code>-7 -1  8
-4 -6  7
-3 -6  6

2
</code>```

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

-365
</code>```

```<code> 8  3  5  6  6 -7  5
 6  2  4 -2 -1  8  3
 2  1 -5  3  8  2 -3
 3 -1  0  7 -6  7 -5
 0 -8 -4 -9 -4  2 -8
 8 -9 -3  5  7  8  5
 8 -1  4  5  1 -4  8

17611
</code>```

```<code>-9 -7  2  1  1 -2  3 -7 -3  6  7  1  0
-7 -8 -9 -2  7 -2  5  4  7 -7  8 -9  8
-4  4 -1  0  1  5 -3  7  1 -2 -9  4  8
 4  8  1 -1  0  7  4  6 -9  3 -9  3 -9
-6 -8 -4 -8 -9  2  1  1 -8  8  2  6 -4
-8 -5  1  1  2 -9  3  7  2  5 -6 -1  2
-8 -5 -7 -4 -9 -2  5  0  2 -4  2  0 -2
-3 -6 -3  2 -9  8  1 -5  5  0 -4 -1 -9
-9 -9 -8  0 -5 -7  1 -2  1 -4 -1  5  7
-6 -9  4 -2  8  7 -9 -5  3 -1  1  8  4
-6  6 -3 -4  3  5  6  8 -2  5 -1 -7 -9
-1  7 -9  4  6  7  6 -8  5  1  0 -3  0
-3 -2  5 -4  0  0  0 -1  7  4 -9 -4  2

-28473770
</code>```

This is a codegolf challenge so the program with the lowest bytecount wins

答:
Python 2.7, 229 bytes

This is my first attempt at something like this, so hopefully I followed all the rules with this submission. This is just a function which takes in a list of lists as its parameter. I feel like the sums and list comprehension could probably be shortened a little bit, but it was too hard for me. :D

```<code>def r(M):
  t=len(M)
  if t==1:return M[0][0]
  M[t/2][t/2]+=sum(a*b for k in [[l[x] for l in M]for x in range(0,t)]for a,b in enumerate(k,1))+sum([i*j for l in M for i,j in enumerate(l,1)])
  return r([p[+1:-1]for p in M[1:-1]])
</code>```

Thx to Easterly Irk for helping me shave off a few bytes.

Title: Index sum and strip my matrix

Body:
Python 2.7, 229 bytes

This is my first attempt at something like this, so hopefully I followed all the rules with this submission. This is just a function which takes in a list of lists as its parameter. I feel like the sums and list comprehension could probably be shortened a little bit, but it was too hard for me. :D

def r(M):
  t=len(M)
  if t==1:return M[0][0]
  M[t/2][t/2]+=sum(a*b for k in [[l[x] for l in M]for x in range(0,t)]for a,b in enumerate(k,1))+sum([i*j for l in M for i,j in enumerate(l,1)])
  return r([p[+1:-1]for p in M[1:-1]])

Thx to Easterly Irk for helping me shave off a few bytes.


答:
Reng -> ><> -> Vitsy, 32 / 2 = 16 points

I wanted to do only 2D languages--on a single line!

```<code>{'Z"Rube Goldberg"'ol?!;f3+0.}n~
</code>```

Explanation

```<code>Reng sees:  {'Z"Rube Goldberg"'ol?!;f3+0.}n~
            <---------------------------->    code block
                                          n~  print that and stop

><> sees:   {'Z"Rube Goldberg"'ol?!;f3+0.}
            {                                 no-op?
             'Z"Rube Goldberg"'               push that string backwards
                               o              output a char
                                l?!;          terminate if none are left
                                    f3+0.     go to (0, 18) in the codebox

Vitsy sees: "grebdloG ebuR"Z
            "............."                   push that string
                           Z                  output it
</code>```

Title: Rube Goldberg Hello World

Body:
For this golf, you will need to use more than one language.

The task

A Rube Goldberg machine is a contraption that takes an enormous number of complicated steps in order to execute a very simple task. The goal of this golf is to output Rube Goldberg... but not directly.

The machine

Your "machine" is the source code that, once executed, will give another source code in another language that will output Rube Goldberg upon execution. Got it?

I rephrase: your initial code must give another code, that other code must output Rube Goldberg. Both codes must be written in different languages.

The bonus which is more like the only fun way to do it

There is a bonus if your code outputs a code that will output a code that will ... that will output Rube Goldberg.

NOTE: any sort of output can be used (stdout, stderr, dialog box, ...)

The points

The number of points is equal to the number of bytes used in your code, divided by the number of distinct, extra languages that you used.

NOTE: different languages use different encodings. The number of bytes is counted in the initial language with its own encoding.

Examples

Pyth -> J -> Javascript -> output in 30 bytes = 30/2 = 15 points (J and Javascript are the extra languages)

Java -> C# -> C++ -> PHP -> output in 36 bytes = 36/3 = 12 points (More bytes and more languages can win over fewer bytes and fewer languages (I know there is no way that these languages do it in 36 bytes))

C -> output in 10 bytes = 10/0 = Infinity points (No extra languages)

Python -> Perl -> Ruby -> Python -> Ruby in 44 bytes = 44/2 = 22 points (Perl and Ruby are the extra languages, the second Python is not counted as it is not an extra language, the second Ruby is not counted as it has already been used)

NOTE: Languages that output their input can't be used. That would be an extra language with absolutely no additional bytes.

The answer

Please provide an answer that clearly states which languages you used and shows us the code at each step (i.e.: in each language).

The winner

Of course, like usual, the lowest score wins.

NOTE: As usual, standard loopholes and "cheats" are not allowed.

Body:
Reng -> ><> -> Vitsy, 32 / 2 = 16 points

I wanted to do only 2D languages--on a single line!

{'Z"Rube Goldberg"'ol?!;f3+0.}n~

Explanation

Reng sees:  {'Z"Rube Goldberg"'ol?!;f3+0.}n~
            <---------------------------->    code block
                                          n~  print that and stop

><> sees:   {'Z"Rube Goldberg"'ol?!;f3+0.}
            {                                 no-op?
             'Z"Rube Goldberg"'               push that string backwards
                               o              output a char
                                l?!;          terminate if none are left
                                    f3+0.     go to (0, 18) in the codebox

Vitsy sees: "grebdloG ebuR"Z
            "............."                   push that string
                           Z                  output it


Title: Rube Goldberg Hello World

Body:
33 languages, 40 bytes, 1.25 points

33.Bubblegum    : (hexdump) 3f1dbbbc87ebd1594f79fdbfa01c8a8ded64e1796d24d2f23e0115677f3cd9b3cd59c217c75a5c30
32.///          : "echo "B*"Rube Goldberg"+````{`]"print(%s)"e%}E*/
31.CJam         : "echo "B*"Rube Goldberg"+````{`]"print(%s)"e%}E*
30.Python       : (524,452 bytes)
29.Falcon       : (262,301 bytes)
28.Groovy       : (131,222 bytes)
27.JavaScript   : ( 65,679 bytes)
26.Julia        : ( 32,904 bytes)
25.Lua          : ( 16,513 bytes)
24.Move         : print("print(\"print(\\\"print(\\\\\\\"print(\\\\\\\\\\\\\\\"print(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"print(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"print(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\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\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\")\\\\\\\")\\\")\")")
20.Swift        : print("print(\"print(\\\"print(\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\")\\\")\")")
19.Yabasic      : print("print(\"print(\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\"\\\")\")")
18.MoonScript   : print("print(\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\"\\\"\")")
17.R            : print("\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg\\\\\\\\\\\\\\\"\\\\\\\"\\\"\"")
16.Arcyóu       : [1] "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg\\\\\\\\\\\\\\\"\\\\\\\"\\\"\""
15.Convex       : "\"\\\"\\\\\\\"echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg\\\\\\\"\\\"\""
14.GolfScript   : "\"\\\"echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg\\\"\""
13.Pyth         : "\"echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg\""
12.Foo          : "echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg"
11.ash          : echo echo echo echo echo echo echo echo echo echo echo Rube Goldberg
10.bash         : echo echo echo echo echo echo echo echo echo echo Rube Goldberg
09.csh          : echo echo echo echo echo echo echo echo echo Rube Goldberg
08.dash         : echo echo echo echo echo echo echo echo Rube Goldberg
07.fish         : echo echo echo echo echo echo echo Rube Goldberg
06.ksh          : echo echo echo echo echo echo Rube Goldberg
05.mksh         : echo echo echo echo echo Rube Goldberg
04.pash         : echo echo echo echo Rube Goldberg
03.rc           : echo echo echo Rube Goldberg
02.tcsh         : echo echo Rube Goldberg
01.zsh          : echo Rube Goldberg
00.OUTPUT       : Rube Goldberg

Takes advantage of the fact that many different languages share the same printing syntax, resulting in exponentially longer but highly compressible source code.

Permalinks (incomplete, to be updated)

Bubblegum

///

CJam


问:
Count sum of all digits
This challenge is to write a program or script which counts the sum of all digits within the integers from 1 up to and including a given number.

Input, one positive integer.
Output, the sum of digits in that number and all smaller numbers.

Examples:

```<code>Input: 5
Integer Sequence: 1, 2, 3, 4, 5
Sum of Digits: 1 + 2 + 3 + 4 + 5 = 15

Input: 12
Integer Sequence: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
Sum of Digits: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 0 + 1 + 1 + 1 + 2 = 51
</code>```

To be clear, this is to count a sum of the digits - not the integers. For single-digit inputs, this will be the same. However, inputs larger than 10 will have different responses. This would be an incorrect response:

```<code>Input: 12
Output: 78
</code>```

Another example, to show the difference:

```<code>Input: 10

Integer Sequence: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Sum of Integers (INCORRECT RESPONSE): 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55

Digit Sequence: 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0
Sum of Digits (CORRECT RESPONSE): 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 0 = 46
</code>```

A larger test case (CORRECT RESPONSE):

```<code>Input: 1000000
Output: 27000001
</code>```

Rules & Guidelines:

Submitted code must be a complete program or script - not just a function. If the code requires includes, imports, etc., they must be included in the posted code.

The number must be input by the user - not hard-coded. Input may be received as a command-line argument, file, stdin, or any other means by which your language can take user input.

The code must be able to properly handle inputs at least up to (2^64)-1.

The code should only output the sum.

Submitted programs & scripts should be user-friendly and not wasteful of computer resources (e.g.: they should not declare insanely-large arrays to hold every character). There is no strict bonus or penalty for this, but please be good programmers.

Scoring:

Primary scoring mechanism is by code length. Lower scores are better. The following bonuses and penalties also apply:

-25 Bonus if your code can handle all positive numbers, for example: 1234567891234567891234564789087414984894900000000

-50 Bonus if your code can handle simple expressions, for example 55*96-12. To qualify for this bonus, the code should handle + - / * (addition, subtraction, division, multiplication) operators and enforce order of operations. Division is regular integer division.

The given example (55*96-12) evaluates to 5268. Your code should return the same for either of those inputs - correct answer is 81393.

-10 Bonus if your code qualifies for the -50 bonus and can handle the ^ (exponent) operator.

-100 Bonus if your code qualifies for the -50 bonus and does not use eval or similar to handle expressions.

+300 Penalty if your code relies upon any web resources.

答:
Python 3, 76 bytes - (25 + 50 + 10) = -9

Put this as a separate answer because it's not anything fancy.

Also, ** is the exponentiation operator because ^ is XOR. I believe this still qualifies for the -10 bonus.

```<code>print(sum(map(int, list("".join(map(str, range(1,eval(str(input()))+1)))))))
</code>```

Title: Count sum of all digits

Body:
Python 3, 76 bytes - (25 + 50 + 10) = -9

Put this as a separate answer because it's not anything fancy.

Also, ** is the exponentiation operator because ^ is XOR. I believe this still qualifies for the -10 bonus.

print(sum(map(int, list("".join(map(str, range(1,eval(str(input()))+1)))))))


问:
"Add one" to every color in an image
You would simply take this image and make every color added one to every hexadecimal digit. For example, #49de5f would become #5aef60 (with the 9 looping to an a, and the f looping to a 0.)

This would also mean that all white (#ffffff) would become black (#000000) because all f loops back to 0, but all black will become a lighter shade of black (#111111).

Scoring is based on the least number of bytes used, as this is a code-golf question.

Use the below image as the input image for your code, and put the output image of your code into your answer.

If you want to, you can also use this other rainbow image:

答:
C - <s>114</s> <s>113</s> <s>70</s> <s>66</s> <s>61</s> <s>72</s> 67 bytes

Here's the code (with support for Martin Ender's test case (without it's 60b)):

main(c,b){for(;~(b=getchar());putchar(c++<54?b:b+16&240|b+1&15));}
```

<p>And here is less obfuscated version:</p>

<pre class="lang-c prettyprint-override"><code>main( c, b ) //Defaults to int
{
    //Get characters until EOF occurs
    //Copy first 54 bytes of header, later add 1 to each hexadecimal digit
    for ( ; ~( b = getchar( ) ); putchar( c++ < 54 ? b: b + 16 & 240 | b + 1 & 15 ) );
}
</code>```

Compile and run with gcc -o color colorgolf.c && cat a.bmp | ./color > b.bmp

This code supports works with bitmaps. To convert png files to bmp, I used following command: convert -flatten -alpha off png.png a.bmp

Code assumes, that bmp header is 54 bytes long - in this case it works, but I'm not sure if I'm not discreetly breaking something.

Also, this is the rainbow:

Title: "Add one" to every color in an image

Body:
C - <s>114</s> <s>113</s> <s>70</s> <s>66</s> <s>61</s> <s>72</s> 67 bytes

Here's the code (with support for Martin Ender's test case (without it's 60b)):

main(c,b){for(;~(b=getchar());putchar(c++<54?b:b+16&240|b+1&15));}

And here is less obfuscated version:

main( c, b ) //Defaults to int
{
    //Get characters until EOF occurs
    //Copy first 54 bytes of header, later add 1 to each hexadecimal digit
    for ( ; ~( b = getchar( ) ); putchar( c++ < 54 ? b: b + 16 & 240 | b + 1 & 15 ) );
}

Compile and run with gcc -o color colorgolf.c && cat a.bmp | ./color > b.bmp

This code supports works with bitmaps. To convert png files to bmp, I used following command: convert -flatten -alpha off png.png a.bmp

Code assumes, that bmp header is 54 bytes long - in this case it works, but I'm not sure if I'm not discreetly breaking something.

Also, this is the rainbow:


问:
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>```

答:
C 213 Bytes

```<code>int c=1,m,n,O,z='z';void main(){O=0;m=c%5-c%3;if(c>2){O=!m&&n?printf("Fiz%cBuz%c",z,z):O;O=m<0&&n+1?printf("Buz%c",z):O;O=m!=n&&m+1&&!O?printf("Fiz%c",z):O;}n=m;O?0:printf("%i",c);putchar(10);c++;if(c<101)main();}
</code>```

Everything is based on counter % 5 - counter % 3.

Title: Obfuscated FizzBuzz Golf

Body:
C 213 Bytes

int c=1,m,n,O,z='z';void main(){O=0;m=c%5-c%3;if(c>2){O=!m&&n?printf("Fiz%cBuz%c",z,z):O;O=m<0&&n+1?printf("Buz%c",z):O;O=m!=n&&m+1&&!O?printf("Fiz%c",z):O;}n=m;O?0:printf("%i",c);putchar(10);c++;if(c<101)main();}

Everything is based on counter % 5 - counter % 3.


答:
Python 3, 112 bytes NOT COMPETING

```<code>def c(x):x=x.translate(None,",.");print“$”+‘{:,.2f}’.format([1.1,1.37,0.15][“€£¥”.index(x[0])]*int(x[1:])/100,2)
</code>```

This is not competing because I do not think that I am allowed to answer my own question.

Also, I have not yet had a chance to run this on a computer, but it seems to me like it should work. I will run it on a computer as soon as I have a chance.

Title: I only pay with dollars

Body:
As the title -- although discretely -- hints, I only pay with dollars.

The challenge

Write a function/program that takes a string as input, which is a monetary value preceded by a symbol. ex) £4.99. Then, return that same amount converted to USD.

Input

You will get a string as input. It will have the currency symbol followed by a number with two decimal places (which could be .00). There will either be decimal points . and/or commas , separating the number. The following currency symbols will come in the inputs:

Euro: €
Pound Sterling: £
Yuan Renminbi: ¥

Also, there will be a comma or decimal point depending on the currency to separate the 'dollars' from the 'cents':

Euro: #.###,##
Pound Sterling: #,###.##
Yuan Renminbi: #,###.##

Output

You will convert the input from the currency determined by the symbol to USD, rounding to two decimal places. The output will be in the format $#,###.##, and there will of course be more numbers on the left of the output if need be (EDIT: this means that there is an arbitrary number of commas in the output, just like in the input). The currency exchange rate we will be using are below.

You can assume that the input contains a symbol that is only one of the above (€ £ ¥ . ,)--that it is always valid.

Exchange rates

```<code>€1 : $1.10
£1 : $1.37
¥1 : $0.15
</code>```

Examples

```<code>Input:
€1,37
£4.00
¥2,782,122.78

Respective output:
$1.51
$5.48
$417,318.42
</code>```

Final words

If you use one of the above symbols (€, £, ¥), you may count them as 1 byte

This is code golf, so shortest code in bytes wins!

Body:
Python 3, 112 bytes NOT COMPETING

def c(x):x=x.translate(None,",.");print“$”+‘{:,.2f}’.format([1.1,1.37,0.15][“€£¥”.index(x[0])]*int(x[1:])/100,2)

This is not competing because I do not think that I am allowed to answer my own question.

Also, I have not yet had a chance to run this on a computer, but it seems to me like it should work. I will run it on a computer as soon as I have a chance.


问:
Time for some TEA!

Introduction

A while back I stumbled across the tiny encryption algorithm (TEA) and since then I have recommended it whenever special cryptographic security properties were un-needed and a self-implementation was a requirement.

Now today, we want to take the name *tiny* encryption algorithm literally and your task will be to implement the tiniest encryption algorithm!

Specification

Input

The input is a list of 8 bytes (or your language equivalent), this is the plaintext, and another list of 16 bytes (or your language equivalent), this is the key.

Input conversion from decimal, hexadecimal, octal or binary is allowed.
 Reading 1 64-bit, 2 32-bit or 4 16-bit integers as output (optionally as a list) is allowed (for the plaintext, double the numbers for the key)

Output

The output is a list of 8 bytes (or your language equivalent), this is the ciphertext.

Output conversion to decimal, hexadecimal, octal or binary is allowed, but not mandatory.

Writing 1 64-bit, 2 32-bit or 4 16-bit integers as output (optionally as a list) is allowed.

What to do?

Your task is to implement the encryption direction of the tiny encryption algorithm (TEA), note XTEA and XXTEA are other algorithms.

Wikipedia has a C-code example and a list of references to some implementations in other languages, this is the original description (PDF).

More Formally:

```<code>Let k1, k2, k3, k4, v1, v2, sum be unsigned 32-bit integers.
(k1,k2,k3,k4) <- key input
(v1,v2) <- plaintext input
sum <- 0
repeat 32 times:
    sum <- ( sum + 0x9e3779b9 ) mod 2^32
    v0  <- ( v0 + ( ((v1 << 4) + k0) XOR (v1 + sum) XOR ((v1 >> 5) + k1) ) ) mod 2^32
    v1  <- ( v1 + ( ((v0 << 4) + k2) XOR (v0 + sum) XOR ((v0 >> 5) + k3) ) ) mod 2^32
output <- (v0,v1)

where 0x9e3779b9 is a hexadecimal constant and
"<<" denotes logical left shift and ">>" denotes logical right shift.
</code>```

Potential corner cases

\0 is a valid character and you may not shorten your input nor output.

Integer encoding is assumed to be little-endian (e.g. what you probably already have).

Who wins?

This is code-golf so the shortest answer in bytes wins!

Standard rules apply of course.

Test-cases

Test vectors were generated using the Wikipedia C code example.

```<code>Key: all zero (16x \0)
Plaintext -> Ciphertext (all values as two 32-bit hexadecimal words)
00000000 00000000 -> 41ea3a0a 94baa940
3778001e 2bf2226f -> 96269d3e 82680480
48da9c6a fbcbe120 -> 2cc31f2e 228ad143
9bf3ceb8 1e076ffd -> 4931fc15 22550a01
ac6dd615 9c593455 -> 392eabb4 505e0755
ebad4b59 7b962f3c -> b0dbe165 cfdba177
ca2d9099 a18d3188 -> d4641d84 a4bccce6
b495318a 23a1d131 -> 39f73ca0 bda2d96c
bd7ce8da b69267bf -> e80efb71 84336af3
235eaa32 c670cdcf -> 80e59ecd 6944f065
762f9c23 f767ea2c -> 3f370ca2 23def34c
</code>```

Here are some self-generated test vectors with non-zero keys:

```<code>format: ( 4x 32-bit word key , 2x 32-bit word plaintext ) -> ( 2x 32-bit word ciphertext )
(all in hexadecimal)

( 4300e123 e39877ae 7c4d7a3c 98335923 , a9afc671 79dcdb73 ) -> ( 5d357799 2ac30c80 )
( 4332fe8f 3a127ee4 a9ca9de9 dad404ad , d1fe145a c84694ee ) -> ( a70b1d53 e7a9c00e )
( 7f62ac9b 2a0771f4 647db7f8 62619859 , 618f1ac2 67c3e795 ) -> ( 0780b34d 2ca7d378 )
( 0462183a ce7edfc6 27abbd9a a634d96e , 887a585d a3f83ef2 ) -> ( d246366c 81b87462 )
( 34c7b65d 78aa9068 599d1582 c42b7e33 , 4e81fa1b 3d22ecd8 ) -> ( 9d5ecc3b 947fa620 )
( f36c977a 0606b8a0 9e3fe947 6e46237b , 5d8e0fbe 2d3b259a ) -> ( f974c6b3 67e2decf )
( cd4b3820 b2f1e5a2 485dc7b3 843690d0 , 48db41bb 5ad77d7a ) -> ( b4add44a 0c401e70 )
( ee2744ac ef5f53ec 7dab871d d58b3f70 , 70c94e92 802f6c66 ) -> ( 61e14e3f 89408981 )
( 58fda015 c4ce0afb 49c71f9c 7e0a16f0 , 6ecdfbfa a705a912 ) -> ( 8c2a9f0c 2f56c18e )
( 87132255 41623986 bcc3fb61 7e6142ce , 9d0eff09 55ac6631 ) -> ( 8919ea55 c7d430c6 )
</code>```

答:
JavaScript (ES6), <s>122</s> <s>118</s> <s>114</s> 113 bytes

f=
(v,w,k,l,m,n)=>{for(s=0;s<84e9;v+=w*16+k^w+s^(w>>>5)+l,w+=v*16+m^v+s^(v>>>5)+n)s+=0x9e3779b9;return[v>>>0,w>>>0]}
;```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div oninput="[r0.value,r1.value]=f(...[v0,v1,k0,k1,k2,k3].map(i=>parseInt(i.value,16))).map(i=>(i+(1<<30)*4).toString(16).slice(1))">
Plain 0: <input id=v0><br>
Plain 1: <input id=v1><br>
Key 0: <input id=k0><br>
Key 1: <input id=k1><br>
Key 2: <input id=k2><br>
Key 3: <input id=k3><br>
</div>
Cipher 0: <input id=r0 readonly><br>
Cipher 1: <input id=r1 readonly><br></code>```

Note: Uses little-endian arithmetic. Accepts and returns unsigned 32-bit integer values. Edit: Saved 4 bytes by using multiplication instead of left shift. Saved 4 bytes by testing on s thus avoiding a separate loop variable. Saved 1 byte by moving the +=s inside the for.

Title: Time for some TEA!

Body:
JavaScript (ES6), <s>122</s> <s>118</s> <s>114</s> 113 bytes

f=
(v,w,k,l,m,n)=>{for(s=0;s<84e9;v+=w*16+k^w+s^(w>>>5)+l,w+=v*16+m^v+s^(v>>>5)+n)s+=0x9e3779b9;return[v>>>0,w>>>0]}
;

<div oninput="[r0.value,r1.value]=f(...[v0,v1,k0,k1,k2,k3].map(i=>parseInt(i.value,16))).map(i=>(i+(1<<30)*4).toString(16).slice(1))">
Plain 0: <input id=v0><br>
Plain 1: <input id=v1><br>
Key 0: <input id=k0><br>
Key 1: <input id=k1><br>
Key 2: <input id=k2><br>
Key 3: <input id=k3><br>
</div>
Cipher 0: <input id=r0 readonly><br>
Cipher 1: <input id=r1 readonly><br>

Note: Uses little-endian arithmetic. Accepts and returns unsigned 32-bit integer values. Edit: Saved 4 bytes by using multiplication instead of left shift. Saved 4 bytes by testing on s thus avoiding a separate loop variable. Saved 1 byte by moving the +=s inside the for.


答:
Python 3.5, <s>101</s> 98

```<code>lambda x:'${:,.2f}'.format(int(x[1:].translate({44:'',46:''}))*{'€':110,'£':137,'¥':15}[x[0]]/1e4)
</code>```

The Euro, Pound, and Yen symbols are counted as 1 byte/character each, per the challenge rules.

Instead of translating among or interpreting thousands and decimal separators, these are just stripped out to give a plain digit string.

The digit string (after the currency symbol) is converted to an integer.

The currency symbol is used as an index into a dictionary of conversion rates; the conversion is performed by multiplying by the conversion rate and dividing by 10000.

The result is formatted with a leading dollar sign, two decimal places of precision, and commas for grouping.

Title: I only pay with dollars

Body:
Python 3.5, <s>101</s> 98

lambda x:'${:,.2f}'.format(int(x[1:].translate({44:'',46:''}))*{'€':110,'£':137,'¥':15}[x[0]]/1e4)

The Euro, Pound, and Yen symbols are counted as 1 byte/character each, per the challenge rules.

Instead of translating among or interpreting thousands and decimal separators, these are just stripped out to give a plain digit string.

The digit string (after the currency symbol) is converted to an integer.

The currency symbol is used as an index into a dictionary of conversion rates; the conversion is performed by multiplying by the conversion rate and dividing by 10000.

The result is formatted with a leading dollar sign, two decimal places of precision, and commas for grouping.


答:
Ruby, <s>114</s> <s>113</s> 106 bytes

Because Ruby doesn't have 32-bit arithmetic, the extra mod operations caused it to almost tie with Javascript anyways despite the other byte-saving operations Ruby has...

(-1 byte from extra semicolon)

(-7 bytes from trimming out unnecessary mod operations and shifting stuff around)

Try it online!

```<code>->v,w,a,b,c,d{s=0
32.times{s+=0x9e3779b9;v+=w*16+a^w+s^w/32+b;v%=m=2**32;w+=v*16+c^v+s^v/32+d;w%=m}
[v,w]}
</code>```

Title: Time for some TEA!

Body:
Introduction

A while back I stumbled across the tiny encryption algorithm (TEA) and since then I have recommended it whenever special cryptographic security properties were un-needed and a self-implementation was a requirement.

Now today, we want to take the name *tiny* encryption algorithm literally and your task will be to implement the tiniest encryption algorithm!

Specification

Input

The input is a list of 8 bytes (or your language equivalent), this is the plaintext, and another list of 16 bytes (or your language equivalent), this is the key.

Input conversion from decimal, hexadecimal, octal or binary is allowed.
 Reading 1 64-bit, 2 32-bit or 4 16-bit integers as output (optionally as a list) is allowed (for the plaintext, double the numbers for the key)

Output

The output is a list of 8 bytes (or your language equivalent), this is the ciphertext.

Output conversion to decimal, hexadecimal, octal or binary is allowed, but not mandatory.

Writing 1 64-bit, 2 32-bit or 4 16-bit integers as output (optionally as a list) is allowed.

What to do?

Your task is to implement the encryption direction of the tiny encryption algorithm (TEA), note XTEA and XXTEA are other algorithms.

Wikipedia has a C-code example and a list of references to some implementations in other languages, this is the original description (PDF).

More Formally:

```<code>Let k1, k2, k3, k4, v1, v2, sum be unsigned 32-bit integers.
(k1,k2,k3,k4) <- key input
(v1,v2) <- plaintext input
sum <- 0
repeat 32 times:
    sum <- ( sum + 0x9e3779b9 ) mod 2^32
    v0  <- ( v0 + ( ((v1 << 4) + k0) XOR (v1 + sum) XOR ((v1 >> 5) + k1) ) ) mod 2^32
    v1  <- ( v1 + ( ((v0 << 4) + k2) XOR (v0 + sum) XOR ((v0 >> 5) + k3) ) ) mod 2^32
output <- (v0,v1)

where 0x9e3779b9 is a hexadecimal constant and
"<<" denotes logical left shift and ">>" denotes logical right shift.
</code>```

Potential corner cases

\0 is a valid character and you may not shorten your input nor output.

Integer encoding is assumed to be little-endian (e.g. what you probably already have).

Who wins?

This is code-golf so the shortest answer in bytes wins!

Standard rules apply of course.

Test-cases

Test vectors were generated using the Wikipedia C code example.

```<code>Key: all zero (16x \0)
Plaintext -> Ciphertext (all values as two 32-bit hexadecimal words)
00000000 00000000 -> 41ea3a0a 94baa940
3778001e 2bf2226f -> 96269d3e 82680480
48da9c6a fbcbe120 -> 2cc31f2e 228ad143
9bf3ceb8 1e076ffd -> 4931fc15 22550a01
ac6dd615 9c593455 -> 392eabb4 505e0755
ebad4b59 7b962f3c -> b0dbe165 cfdba177
ca2d9099 a18d3188 -> d4641d84 a4bccce6
b495318a 23a1d131 -> 39f73ca0 bda2d96c
bd7ce8da b69267bf -> e80efb71 84336af3
235eaa32 c670cdcf -> 80e59ecd 6944f065
762f9c23 f767ea2c -> 3f370ca2 23def34c
</code>```

Here are some self-generated test vectors with non-zero keys:

```<code>format: ( 4x 32-bit word key , 2x 32-bit word plaintext ) -> ( 2x 32-bit word ciphertext )
(all in hexadecimal)

( 4300e123 e39877ae 7c4d7a3c 98335923 , a9afc671 79dcdb73 ) -> ( 5d357799 2ac30c80 )
( 4332fe8f 3a127ee4 a9ca9de9 dad404ad , d1fe145a c84694ee ) -> ( a70b1d53 e7a9c00e )
( 7f62ac9b 2a0771f4 647db7f8 62619859 , 618f1ac2 67c3e795 ) -> ( 0780b34d 2ca7d378 )
( 0462183a ce7edfc6 27abbd9a a634d96e , 887a585d a3f83ef2 ) -> ( d246366c 81b87462 )
( 34c7b65d 78aa9068 599d1582 c42b7e33 , 4e81fa1b 3d22ecd8 ) -> ( 9d5ecc3b 947fa620 )
( f36c977a 0606b8a0 9e3fe947 6e46237b , 5d8e0fbe 2d3b259a ) -> ( f974c6b3 67e2decf )
( cd4b3820 b2f1e5a2 485dc7b3 843690d0 , 48db41bb 5ad77d7a ) -> ( b4add44a 0c401e70 )
( ee2744ac ef5f53ec 7dab871d d58b3f70 , 70c94e92 802f6c66 ) -> ( 61e14e3f 89408981 )
( 58fda015 c4ce0afb 49c71f9c 7e0a16f0 , 6ecdfbfa a705a912 ) -> ( 8c2a9f0c 2f56c18e )
( 87132255 41623986 bcc3fb61 7e6142ce , 9d0eff09 55ac6631 ) -> ( 8919ea55 c7d430c6 )
</code>```

Body:
Ruby, <s>114</s> <s>113</s> 106 bytes

Because Ruby doesn't have 32-bit arithmetic, the extra mod operations caused it to almost tie with Javascript anyways despite the other byte-saving operations Ruby has...

(-1 byte from extra semicolon)

(-7 bytes from trimming out unnecessary mod operations and shifting stuff around)

Try it online!

->v,w,a,b,c,d{s=0
32.times{s+=0x9e3779b9;v+=w*16+a^w+s^w/32+b;v%=m=2**32;w+=v*16+c^v+s^v/32+d;w%=m}
[v,w]}


答:
F#, 198 bytes

```<code>(s:string)="$"+(System.Double.Parse(if s.[0]='€'then s.[1..].Replace(".","").Replace(',','.')else s.[1..].Replace(",",""))*(if s.[0]='€'then 1.1 else if s.[0]='£'then 1.37 else 0.15)).ToString("N2")
</code>```

Un-Golfed:

```<code>let IOnlyUseDollars(s : string) =
    let cur = s.[0]
    let str = if cur = '€' then s.[1..].Replace(".","").Replace(',', '.') else s.[1..].Replace(",","")
    let amt = System.Double.Parse(str)
    let dol = amt * (if cur = '€' then 1.1 else if cur = '£' then 1.37 else 0.15)
    "$" + dol.ToString("N2")
</code>```

I'm still trying to figure out F#, so dealing with the thousands separators is taking up a lot of bytes.

According to the challenge rules, the Euro, Yen, and Pound symbols count as one byte each, despite how Unicode stores them internally.

Title: I only pay with dollars

Body:
F#, 198 bytes

(s:string)="$"+(System.Double.Parse(if s.[0]='€'then s.[1..].Replace(".","").Replace(',','.')else s.[1..].Replace(",",""))*(if s.[0]='€'then 1.1 else if s.[0]='£'then 1.37 else 0.15)).ToString("N2")

Un-Golfed:

let IOnlyUseDollars(s : string) =
    let cur = s.[0]
    let str = if cur = '€' then s.[1..].Replace(".","").Replace(',', '.') else s.[1..].Replace(",","")
    let amt = System.Double.Parse(str)
    let dol = amt * (if cur = '€' then 1.1 else if cur = '£' then 1.37 else 0.15)
    "$" + dol.ToString("N2")

I'm still trying to figure out F#, so dealing with the thousands separators is taking up a lot of bytes.

According to the challenge rules, the Euro, Yen, and Pound symbols count as one byte each, despite how Unicode stores them internally.