तिरछे गिनती!


30

हमारे पास संख्याओं के लिए बहुत से क्षैतिज अक्ष हैं, लेकिन मुझे ईमानदारी से लगता है कि वे एक तरह से उबाऊ हैं। आपका कार्य आज मुझे इनपुट के रूप में दिए गए दो अलग-अलग गैर-नकारात्मक पूर्णांक के बीच एक विकर्ण अक्ष का एक हिस्सा बनाना है।

विकर्ण अक्ष का निर्माण कैसे करें?

  • चलिए एक उदाहरण लेते हैं, इनपुट के साथ 0, 5। हमारी धुरी इस तरह दिखनी चाहिए:

    0
     1
      2
       3
        4
         5
    
  • हालाँकि, हमारी धुरी उन संख्याओं के लिए अच्छी दिखनी चाहिए, जिनमें अधिक अंक भी हैं! यदि इनपुट है, उदाहरण के लिए 0, 14, नया अक्ष होना चाहिए:

    0
     1
      2
       3
        4
         5
          6
           7
            8
             9
              10
                1 1
                  12
                    13
                      14
    
  • विचार यह है कि अक्ष पर अगले संख्या का पहला अंक हमेशा पिछली संख्या के अंतिम अंक के ठीक बाद रखा जाना चाहिए। विचार को और भी बेहतर समझने के लिए, यहाँ एक और उदाहरण दिया गया है 997, 1004:

    997
       998
          999
             1000
                 1001
                     1002
                         1003
                             1004
    

नियम

  • आप मान सकते हैं कि इनपुट आरोही या अवरोही क्रम में है (आप चुन सकते हैं 5,3और 3,5)।

  • आप यह भी मान सकते हैं कि दो पूर्णांकों के बीच का अंतर 100 से कम है।

  • आपके पास एक अग्रणी नई पंक्ति या एक सुसंगत अग्रणी स्थान (प्रत्येक पंक्ति पर) हो सकता है। ट्रेलिंग स्पेस / न्यूलाइन्स भी ठीक हैं।

  • डिफ़ॉल्ट लूपोल्स निषिद्ध हैं।

  • आप इनपुट ले सकते हैं और किसी भी मानक माध्यम से आउटपुट प्रदान कर सकते हैं ।

  • यह , इसलिए हर भाषा में बाइट्स में सबसे छोटा कोड जीत जाता है!


अन्य परीक्षण मामले

  • 1, 10:

    1
     2
      3
       4
        5
         6
          7
           8
            9
             10
    
  • 95, 103:

    95
      96
        97
          98
            99
              100
                 101
                    102
                       103
    
  • 999999, 1000009:

    999999
          1000000
                 1000001
                        1000002
                               1000003
                                      1000004
                                             1000005
                                                    1000006
                                                           1000007
                                                                  1000008
                                                                         1000009
    

क्या अग्रणी रिक्त स्थान की अनुमति है, या पहले नंबर को स्क्रीन के बाईं ओर बिल्कुल होना चाहिए?
नाथन.इलिशा शिरनी

@NathanShiraini प्रमुख नई सुचनाओं की अनुमति है
श्री Xcoder


@StepHen यह थोड़ा कठिन है, हालांकि, संदर्भ के लिए धन्यवाद।
मिस्टर एक्सकोडर

1
@ अदनान आपके पास प्रत्येक लाइन पर एक अग्रणी न्यूलाइन या एक सुसंगत अग्रणी स्थान हो सकता है।
श्री Xcoder

जवाबों:


19

05AB1E , 8 7 6 बाइट्स

एक बाइट को बचाने के लिए मैजिक ऑक्टोपस यूरन को धन्यवाद !

यह किसी तरह काम करता है, लेकिन ईमानदारी से मुझे पता नहीं क्यों है।

कोड

Ÿvy.O=

05AB1E एन्कोडिंग का उपयोग करता है । इसे ऑनलाइन आज़माएं!

व्याख्या

Ÿ          # Create the range [a, .., b] from the input array
 vy        # For each element
   .O      #   Push the connected overlapped version of that string using the
                 previous version of that string. The previous version initially
                 is the input repeated again. Somehow, when the input array is
                 repeated again, this command sees it as 1 character, which gives
                 the leading space before each line outputted. After the first
                 iteration, it reuses on what is left on the stack from the
                 previous iteration and basically attaches (or overlaps) itself 
                 onto the previous string, whereas the previous string is replaced 
                 by spaces and merged into the initial string. The previous string
                 is then discarded. We do not have to worry about numbers overlapping 
                 other numbers, since the incremented version of a number never
                 overlaps entirely on the previous number. An example of 123 and 456:

                 123
                    456

                 Which leaves us "   456" on the stack.
     =     #   Print with a newline without popping

.O = pop a,b push connected_overlap(b) (deprecated)- ओह, मुझे लगता है?
मैजिक ऑक्टोपस Urn

@MagicOctopusUrn हाँ, .Oअत्यंत छोटी गाड़ी है और एक साल से अधिक समय से वंचित है इसलिए मुझे नहीं पता कि क्या काम करता है और क्या नहीं। मैं शपथ ले सकता हूं कि मुझे जरूरत है Î, लेकिन यह अचानक ऐसा नहीं लगता है (अब?)। धन्यवाद! :)
अदनान

1
Btw, Îप्रमुख स्थानों की अधिकतम संख्या को कम करने के लिए आवश्यक था 1.
अदनान

मैं… रुको… क्या, कैसे…?
मैजिक ऑक्टोपस Urn

1
@ Mr.Xcoder ने कहा
अदनान

14

पायथन 2 , 43 बाइट्स

lambda a,b:'\v'.join(map(str,range(a,b+1)))

सीढ़ी प्रभाव बनाने के लिए ऊर्ध्वाधर टैब का उपयोग करता है। जिस तरह से\v प्रदान किया जाता है वह कंसोल पर निर्भर है, इसलिए यह हर जगह काम नहीं कर सकता है (जैसे TIO)।
running code


क्या आप \x0bबाइट बचाने के लिए अपने कोड में शाब्दिक का उपयोग कर सकते हैं ?
डोम हेस्टिंग्स

@DomHastings शायद, मैं नहीं जानता कि हालांकि
रॉड

मैंने अभी-अभी इसका परीक्षण किया है और यह काम करता दिखाई देता है। परीक्षण करने के लिए फ़ाइल में वर्ण प्राप्त करने के लिए, मैंने उदात्त पाठ का उपयोग किया और regex मोड में एक खोज और प्रतिस्थापन किया \\vऔर \x0Bजिसके साथ एक VTचरित्र को दिखाता है जो स्कोरिंग के लिए अपने स्थान पर दिखाई देता है या तो आप एक प्रतिवर्ती हेक्सडम्प ( xxdया कुछ) या बस पोस्ट कर सकते हैं राज्य है कि: " \vएक शाब्दिक ऊर्ध्वाधर टैब है", मुझे लगता है कि उचित होगा। उम्मीद है की वो मदद करदे!
डोम हेस्टिंग्स

13

चारकोल , co बाइट्स

F…·NN⁺¶ι

इसे ऑनलाइन आज़माएं!

लिंक कोड के वर्बोज़ संस्करण के लिए है। आरोही क्रम में इनपुट।

  • 1 बाइट ASCII- के लिए धन्यवाद बचा लिया!

Nice, Charcoal wins this again!
Mr. Xcoder


EDIT: Charcoal got outgolfed... Wow
Mr. Xcoder

2
@Mr.Xcoder at least I know how my answer works. :-D
Charlie

7

R, 70 69 61 bytes

function(a,b)for(i in a:b){cat(rep('',F),i,'
');F=F+nchar(i)}

Function that takes the start and end variable as arguments. Loops over the sequence, and prints each element, prepended with enough spaces. F starts as FALSE=0, and during each iteration, the amount of characters for that value is added to it. F decides the amount of spaces printed.

Try it online!

-8 bytes thanks to @Giuseppe


I see 70 bytes there. Using scan() twice it can be reduced to 67 bytes for(i in scan():scan()){cat(rep(' ',F),i,'\n',sep='');F=F+nchar(i)}.
djhurio

Unfortunately you have to reset F, otherwise the function can be used only once in a new sessions. F=0;for(i in scan():scan()){cat(rep(' ',F),i,'\n',sep='');F=F+nchar(i)} (71 byte)
djhurio

@djhurio Inside a function, that is not necessary, since F is only modified in its own namespace. Also, I count 69 bytes, using nchar.
JAD

1
But replacing \n for an actual newline works too, and that doesn't cost two bytes apparently.
JAD

1
Nice, I thought of abusing the automatic spacing of cat, but I couldn't think straight and figure it out for some reason.
JAD

6

C#, 90 89 85 bytes

s=>e=>{var r="";for(int g=0;e>s;g+=(s+++"").Length)r+="".PadLeft(g)+s+"\n";return r;}

Saved 1 byte thanks to @LiefdeWen.
Saved 4 bytes thanks to @auhmaan.

Try it online!

Full/Formatted version:

namespace System
{
    class P
    {
        static void Main()
        {
            Func<int, Func<int, string>> f = s => e =>
            {
                var r = "";
                for (int g = 0; e > s; g += (s++ + "").Length)
                    r += "".PadLeft(g) + s + "\n";

                return r;
            };

            Console.WriteLine(f(0)(5));
            Console.WriteLine(f(0)(14));
            Console.WriteLine(f(997)(1004));
            Console.WriteLine(f(1)(10));
            Console.WriteLine(f(95)(103));
            Console.WriteLine(f(999999)(1000009));

            Console.ReadLine();
        }
    }
}

1
+1, now you don't have 5k precisely ;D
Mr. Xcoder

1 byte at i<=e to e>i
LiefdeWen

@LiefdeWen Thanks :)
TheLethalCoder

I believe you can save more 4 bytes by removing the i and reusing the s instead
auhmaan

@auhmaan Thanks don't know why I never think of using the input variable.
TheLethalCoder


6

Mathematica, 59, bytes

Grid[(DiagonalMatrix@Range[1+##]/. 0->""+1)-1,Spacings->0]&

input

[10,15]

-3 bytes @JungHwanMin
problem with 0 fixed (see comments for details)
thanx to @ngenisis


1
Wow, an answer that actually contains the word Diagonal
Mr. Xcoder

You need to add Spacings -> 0 if you want this to be character-exact.
Mr.Wizard

The input is only non-negative, not guaranteed to be positive.
user202729

Grid[(DiagonalMatrix@Range[1+##]/. 0->""+1)-1,Spacings->0]& is the shortest way I could find to fix those problems
ngenisis


5

Mathematica, 48 bytes

Rotate[""<>Table[ToString@i<>" ",{i,##}],-Pi/4]&

since there are so many answers, I thought this one should be included

input

[0,10]

output
enter image description here


1
This isn't valid, is it? But +1 just for taking the title literally.
Zacharý

5

C, 166 134 95 82 Bytes

New Answer

Just as a function not as a whole program.

f(a,b){int s=0,i;while(a<=b){i=s;while(i--)printf(" ");s+=printf("%i\n",a++)-1;}}

Thanks to Falken for helping knock off 13 Bytes (and fix a glitch)!

Thanks to Steph Hen for helping knock off 12 Bytes!

Thanks to Zacharý for help knock off 1 Byte!

Old Answers

Got rid of the int before main and changed const char*v[] to char**v and got rid of return 0;

main(int c,char**v){int s=0;for(int a=atoi(v[1]);a<=atoi(v[2]);a++){for(int i=0;i<s;i++)printf(" ");printf("%i\n",a);s+=log10(a)+1;}}


int main(int c,const char*v[]){int s=0;for(int a=atoi(v[1]);a<=atoi(v[2]);a++){for(int i=0;i<s;i++)printf(" ");printf("%i\n",a);s+=log10(a)+1;}return 0;}

This is my first time golfing and I wanted to try something in C. Not sure if I formatted this correctly, but I had fun making it!

int main(int c, const char * v[]) {
    int s = 0;
    for(int a=atoi(v[1]); a<=atoi(v[2]); a++) {
        for(int i=0; i<s; i++) printf(" ");
        printf("%i\n",a);
        s += log10(a)+1;
    }
    return 0;
}

Explanation

int s = 0; // Number of spaces for each line

for(int a=atoi(argv[1]); a<=atoi(argv[2]); a++) { // Loop thru numbers

for(int i=0; i<s; i++) printf(" "); // Add leading spaces

printf("%i\n",a); // Print number

s += log10(a)+1; // Update leading spaces

Usage

enter image description here


Welcome to PPCG! I believe you can rename argc and argv to one letter variables.
Stephen

I think you can move the int s=0 to the for loop, as in for(int s=0;a<=b;a++).
Zacharý

Ahh your right thanks, I updated the post!
Asleepace

Using int i=s;while(i--) instead of for(int i=0;i<s;i++) for the inner loop will save two bytes.
Falken

1
Ahhh your right forgot about log10 on 0 and negatives, I've updated the solution thanks!
Asleepace

4

C++, 167 165 bytes

-2 bytes thanks to Zacharý

#include<string>
#define S std::string
S d(int l,int h){S r;for(int m=0,i=l,j;i<=h;){for(j=0;j<m;++j)r+=32;S t=std::to_string(i++);r+=t;r+=10;m+=t.size();}return r;}

1. Could you move the int m=0,i=l,j to the first for loop to save a byte? 2. Can you change r+=t;r+=10 to r+=t+10? 3. I beat someone, yay.
Zacharý

@Zacharý I can do r+=t+=10 but not r+=t+10, it gave me an error
HatsuPointerKun

But r+=t+=10 does work? Wouldn't that affect t.size()?
Zacharý

@Zacharý Yes, it works, with only +, it says it can't find an overload with int as parameter, but with += it uses the overload with the char
HatsuPointerKun

Oh, could you move the ++i to the std::to_string(i) as std::to_string(i++) to save one more byte?
Zacharý

4

APL (Dyalog), 25 24 bytes

-1 thanks to Zacharý.

Assumes ⎕IO←0 for zero based counting. Takes the lower bound as left argument and the upper bound as right argument.

{↑⍵↑⍨¨-+\≢¨⍵}(⍕¨⊣+∘⍳1--)

Try it online!

() apply the following tacit function between the arguments:

- subtract the upper lower from the upper bound

1- subtract that from one (i.e. 1 + ∆)

⊣+∘⍳ left lower bound plus the integers 0 through that

⍕¨ format (stringify) each

{} apply the following anonymous on that (represented by ⍵):

≢¨ length of each (number)

+\ cumulative sum

- negate

⍵↑⍨¨ for each stringified number, take that many characters from the end (pads with spaces)

 mix list of strings into character matrix


Could +-⍨ be --?
Zacharý

@Zacharý Yes, of course. Thanks.
Adám

4

Retina, 81 78 bytes

.+
$*
+`\b(1+)¶11\1
$1¶1$&
1+
$.& $.&
 (.+)
$.1$* 
+1`( *)(.+?)( +)¶
$1$2¶$1$3

Try it online! Takes input as a newline-separated list of two integers. Edit: Saved 3 bytes by stealing the range-expansion code from my answer to Do we share the prime cluster? Explanation:

.+
$*

Convert both inputs to unary.

+`\b(1+)¶11\1
$1¶1$&

While the last two elements (a, b) of the list differ by more than 1, replace them with (a, a+1, b). This expands the list from a tuple into a range.

1+
$.& $.&

Convert back to decimal in duplicate.

 (.+)
$.1$* 

Convert the duplicate copy to spaces.

+1`( *)(.+?)( +)¶
$1$2¶$1$3

Cumulatively sum the spaces from each line to the next.



3

LOGO, 53 bytes

[for[i ? ?2][repeat ycor[type "\ ]pr :i fd count :i]]

There is no "Try it online!" link because all online LOGO interpreter does not support template-list.

That is a template-list (equivalent of lambda function in other languages).

Usage:

apply [for[i ? ?2][repeat ycor[type "\ ]pr :i fd count :i]] [997 1004]

(apply calls the function)

will print

997
   998
      999
         1000
             1001
                 1002
                     1003
                         1004

Note:

This uses turtle's ycor (Y-coordinate) to store the number of spaces needed to type, therefore:

  • The turtle need to be set to home in its default position and heading (upwards) before each invocation.
  • window should be executed if ycor gets too large that the turtle moves off the screen. Description of window command: if the turtle is asked to move past the boundary of the graphics window, it will move off screen., unlike the default setting wrap, which if the turtle is asked to move past the boundary of the FMSLogo screen window, it will "wrap around" and reappear at the opposite edge of the window.

Explanation:

for[i ? ?2]        Loop variable i in range [?, ?2], which is 2 input values
repeat ycor        That number of times
type "\            space character need to be escaped to be typed out.
pr :i              print the value of :i with a newline
fd count :i        increase turtle's y-coordinate by the length of the word :i. (Numbers in LOGO are stored as words)


3

JavaScript (ES8), 69 67 62 bytes

Takes input as integers, in ascending order, using currying syntax. Returns an array of strings.

x=>y=>[...Array(++y-x)].map(_=>s="".padEnd(s.length)+x++,s="")

Try it

o.innerText=(f=

x=>y=>[...Array(++y-x)].map(_=>s="".padEnd(s.length)+x++,s="")

)(i.value=93)(j.value=105).join`\n`
oninput=_=>o.innerText=f(Math.min(i.value,j.value))(Math.max(i.value,j.value)).join`\n`
label,input{font-family:sans-serif}input{margin:0 5px 0 0;width:100px;}
<label for=i>x: </label><input id=i type=number><label for=j>y: </label><input id=j type=number><pre id=o>


3

Japt, 12 bytes

òV
£¯Y ¬ç +X

Takes input in either order and always returns the numbers in ascending order, as an array of lines.

Try it online! with the -R flag to join the array with newlines.

Explanation

Implicit input of U and V.

òV
£

Create inclusive range [U, V] and map each value to...

¯Y ¬ç

The values before the current (¯Y), joined to a string (¬) and filled with spaces (ç).

+X

Plus the current number. Resulting array is implicitly output.


3

Python 2, 65 63 62 61 bytes

-2 bytes Thanks to @Mr. Xcoder: exec doesn't need braces

-1 bye thanks to @Zacharý: print s*' ' as print' '*s

def f(m,n,s=0):exec(n-m+1)*"print' '*s+`m`;s+=len(`m`);m+=1;"

Try it online!


1
You do not need the braces for exec. m,n=input();s=0;exec(n-m+1)*"print s*' '+`m`;s+=len(`m`);m+=1;" suffices.
Mr. Xcoder

1
I think you can change print s*' ' to print' '*s to save one byte.
Zacharý

2

JavaScript, 57 bytes

f=(x,y,s='')=>y>=x?s+`
`+f(x+1,y,s.replace(/./g,' ')+x):s

55 bytes: y=>g=(x,s='')=>y<x?s:s+'\n'+g(x+1,s.replace(/./g,' ')+x) Call with currying with the integers reversed: f(103)(95).
Shaggy

54 bytes: x=>y=>g=(s='')=>y<x?s:s+'\n'+g(s.replace(/./g,' ')+x++) Call as f(x)(y)().
Shaggy

2

Python 2, 60 59 bytes

-1 byte thanks to Mr.Xcoder for defining my s=0 as an optional variable in my function.

def f(l,u,s=0):
 while l<=u:print' '*s+`l`;s+=len(`l`);l+=1

Try it online!

I think it is possible to transfer this into a lambda version, but I do not know how. I also think that there is some sort of mapping between the spaces and the length of the current number, but this I also did not figure out yet. So I think there still is room for improvement.

What i did was creating a range from the lowerbound lto the upper bound u printing each line with a space multiplied with a number s. I am increasing the multiplier with the length of the current number.




I'll figure out you did with that "exec"-version later this day. Maybe it will help me in future codings. Thanks
Simon


2

Python 2, 78 77 79 bytes

def f(a,b):
 for i in range(a,b+1):print sum(len(`j`)for j in range(i))*' '+`i`

Try it online!

f(A, B) will print the portion of the axis between A and B inclusive.

First time I answer a challenge!

Uses and abuses Python 2's backticks to count the number of spaces it has to add before the number.

-1 byte thanks to Mr.Xcoder

+2 because I forgot a +1


4
Welcome to PPCG! nice first answer. sum(len(`j`)) for can become sum(len(`j`)for, -1 bytes
Mr. Xcoder

1
To make this answer valid, you must replace range(a,b) with range(a,b+1), because Python has semi inclusive ranges.
Mr. Xcoder

Indeed, I missed that. What's more surprising is that I did add that +1 when I made my tests! No wonder I had 2 bytes missing when I typed it into TiO...
Nathan.Eilisha Shiraini

2

C (gcc), 41 38 bytes

-3 bytes Thanks to ASCII-only

t(x,v){while(x<=v)printf("%d\v",x++);}

Works on RedHat6, accessed via PuTTY

Proof

Try it online!


1
This doesn't produce correct output.
Erik the Outgolfer

it's tricky, output to a file and then use more on that file
Giacomo Garabello

2
@GiacomoGarabello You must provide the full code in order for us to be able to run your program. If you do not provide a working test ground / do not provide instructions on how to run your program such that it produces correct output, please delete this answer.
Mr. Xcoder

Linefeed may return to begin of line, it depends. This does work when it does not.
user202729

@Mr.Xcoder Edited
Giacomo Garabello

2

V, 16 bytes

ÀñÙywÒ $pça/jd

Try it online!

This would be way easier if I could take start end - start but I think that's changing the challenge a bit too much.

This takes the start number as input in the buffer and the end number as an argument. It actually creates the ladder from start to start + end and then deletes everything after the end number.


2

MATL, 11 bytes

vii&:"t~@Vh

Try it online!

Explanation

This works by generating a string for each number and concatenating it with a logically-negated copy of the previous string. Thus char 0 is prepended 0 as many times as the length of the previous string. Char 0 is displayed as a space, and each string is displayed on a different line

v       % Concatenate stack (which is empty): pushes []
ii      % Input two numbers
&:      % Range between the two numbers
"       % For each
  t     %   Duplicate
  ~     %   Logical negation. This gives a vector of zeros
  @     %   Push current number
  V     %   Convert to string
  h     %   Concatenate with the vector of zeros, which gets automatically 
        %   converted into chars.
        % End (implicit). Display stack (implicit), each string on a diferent
        % line, char 0 shown as space

2

Swift 4, 115 bytes

I think nobody would have posted a Swift solution anyway...

func f(l:Int,b:Int){for i in l...b{print(String(repeating:" ",count:(l..<i).map{String($0).count}.reduce(0,+)),i)}}

Try it online!


2

Perl, 19 bytes

Note: \x0b is counted as one byte.

Along with others, I thought using cursor movements would be the shortest route, this does mean it doesn't work on TIO:

print"$_\x0b"for<>..<>

Usage

perl -e 'print"$_\x0b"for<>..<>' <<< '5
10'
5
 6
  7
   8
    9
     10

Nice, haven't seen Perl at all in a while. Could you add a testing link? Additionally, I was wondering what the 1.. does there, since you are given two integers.
Mr. Xcoder

@Mr.Xcoder Yeah, 1.. was me not fully reading the spec, that's fixed now! As for testing it online, because the output contains the vertical tab, it doesn't render as expected. Trying to see if I can find a renderer that does support control chars... If not, that might be my new project!
Dom Hastings

2

Japt, 10 9 bytes

òV åÈç +Y

Test it online! Returns an array of lines; -R flag included to join on newlines for easier viewing.

Explanation

 òV åÈ   ç +Y
UòV åXY{Xç +Y}   Ungolfed
                 Implicit: U, V = inputs, P = empty string
UòV              Create the range [U, U+1, ..., V-1, V].
    åXY{     }   Cumulative reduce: Map each previous result X and current item Y to:
        Xç         Fill X with spaces.
           +Y      Append Y.
                 Implicit: output result of last expression

Old version, 10 bytes:

òV £P=ç +X

Test it online!

 òV £  P= ç +X
UòV mX{P=Pç +X}  Ungolfed
                 Implicit: U, V = inputs, P = empty string
UòV              Create the range [U, U+1, ..., V-1, V].
    mX{       }  Map each item X to:
         Pç        Fill P with spaces.
            +X     Append X.
       P=          Re-set P to the result.
                   Implicitly return the same.
                 Implicit: output result of last expression

Dang, I had just come up with the same solution as an improvement to my own answer.
Justin Mariner

2

D, 133 127 126 125 121 119 bytes

import std.conv,std.stdio;void f(T)(T a,T b,T s=0){for(T j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.

Try it online!

If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 71 bytes:

import std.stdio;void f(T)(T a,T b){while(a<=b){a++.write;'\v'.write;}}

How? (Only D specific tricks)

  • f(T)(T a,T b,T s=0) D's template system can infer types
  • for(T j;j++<s;) Integers default to 0.
  • ' '.write;a.writeln D lets you call fun(arg) like arg.fun (one of the few golfy things D has)
  • a.text.length Same as above, and D also allows you to call a method with no parameters as if it was a property (text is conversion to string)
  • One thing that might be relevant (I didn't use this though) newlines can be in strings!

हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.