Stampa il numero più grande con il minor numero di cifre


37

Dato un elenco non vuoto di numeri interi decimali positivi, genera il numero più grande dall'insieme di numeri con il minor numero di cifre.

L'elenco di input non sarà in alcun ordine particolare e potrebbe contenere valori ripetuti.

Esempi:

[1] -> 1
[9] -> 9
[1729] -> 1729
[1, 1] -> 1
[34, 3] -> 3
[38, 39] -> 39
[409, 12, 13] -> 13
[11, 11, 11, 1] -> 1
[11, 11, 11, 11] -> 11
[78, 99, 620, 1] -> 1
[78, 99, 620, 10] -> 99
[78, 99, 620, 100] -> 99
[1, 5, 9, 12, 63, 102] -> 9
[3451, 29820, 2983, 1223, 1337] -> 3451
[738, 2383, 281, 938, 212, 1010] -> 938

Vince il codice più breve in byte.


I numeri di input possono essere su righe separate?
seshoumara,

@seshoumara Sembra ragionevole, sì.
Calvin's Hobbies,

Risposte:


13

Pyth, 7 3 6 byte

eS.ml`

Test Suite

Spiegazione:

e      Still grab the last element
 S      Still sort
  .ml`   But prefilter the list for those with the (m)inimum length.

Soluzione a 7 byte:

eSh.gl`

Test Suite

Spiegazione:

   .g   Group items in (implicit) input by:
     l  The length of
      ` their representation
  h     Get those with the shortest length
 S      Sort the resulting list
e       and grab the last (i.e. largest) element

6

Python 2, 48 42 byte

-6 byte grazie a @Dennis (utilizzare minanziché sorted)

lambda l:min(l,key=lambda x:(len(`x`),-x))

Tutti i casi di test sono su ideone

Prendi il minimo dell'elenco per (lunghezza, -valore)


1
mindovrebbe funzionare invece di sorted.
Dennis,

@Dennis, oh cavolo - grazie! Probabilmente abbastanza diverso da averlo pubblicato tu stesso.
Jonathan Allan,

Scambio sorted()[0]per min? Ritengo che una banale modifica del tuo codice originale.
Dennis,

C'è anche len(`x`)+1./xper la stessa lunghezza. Peccato che tu abbia bisogno del 1..
xnor

Bene, è più breve di quello che mi è venuto in mente. Buon lavoro!
mbomb007,

6

Gelatina , 7 byte

DL,NµÞḢ

Provalo su TryItOnline
O vedi tutti i casi di test anche su TryItOnline

Come?

DL,NµÞḢ - Main link takes one argument, the list, e.g. [738, 2383, 281, 938, 212, 1010]
D       - convert to decimal, e.g. [[7,3,8],[2,3,8,3],[2,8,1],[9,3,8],[2,1,2],[1,0,1,0]]
 L      - length, e.g. [3,4,3,3,3,4]
   N    - negate, e.g [-738, -2383, -281, -938, -212, -1010]
  ,     - pair, e.g. [[3,-738],[4,-2383],[3,-281],[3,-938],[3,-212],[4,-1010]]
    µ   - make a monadic chain
     Þ  - sort the input by that monadic function, e.g [938,738,281,212,2383,1010]
          (the lists in the example are not created, but we sort over the values shown)
      Ḣ - pop and return the first element, e.g. 938

1
Ottimo uso di sorta!
miglia,

@miles la tua strada era ancora ispirata :)
Jonathan Allan,

5

05AB1E , 5 byte

Codice:

({é¬(

Spiegazione:

(      # Negate the list, e.g. [22, 33, 4] -> [-22, -33, -4]
 {     # Sort, e.g. [-22, -33, -4] -> [-33, -22, -4]
  é    # Sort by length, e.g. [-33, -22, -4] -> [-4, -22, -33]
   ¬   # Get the first element.
    (  # And negate that.

Utilizza la codifica CP-1252 . Provalo online!



4

MATL , 14 byte

10&YlktX<=G*X>

Provalo online!

Spiegazione:

  &Yl           % Log
10              % Base 10
     kt         % Floor and duplicate
       X<       % Find the smallest element
         =      % Filter out elements that do not equal the smallest element
          G     % Push the input again
           *    % Multiply (this sets numbers that do not have the fewest digits to 0)
            X>  % And take the maximum

4

Retina ,24 16 byte

O ^ `
O $ # `
$ .0
G1`

Provalo online! o eseguire tutti i casi di test .

Risparmiato 8 byte grazie a Martin!

Tutto il test utilizza una versione leggermente più vecchia del codice, ma l'algoritmo è identico. Lo aggiornerò per essere più vicino quando avrò più tempo.

La nuova riga finale è significativa. Ordina i numeri per valore numerico inverso, quindi li ordina per numero di cifre. Questo ci lascia con il numero più grande con il minor numero di cifre nella prima posizione, quindi possiamo semplicemente eliminare le cifre rimanenti.


Se si rende separato l'input di avanzamento riga è possibile omettere la regex da entrambe le fasi di ordinamento e quindi utilizzare G1`per l'ultima fase.
Martin Ender,

Inoltre, il primo stadio non è necessario #. Ti preoccupi solo dell'ordine relativo per una determinata lunghezza intera e entro una lunghezza l'ordinamento lessicografico dei numeri è corretto.
Martin Ender,

@MartinEnder Grazie! Ho aggiunto entrambi i tuoi consigli. Avrei dovuto suggerire \w+come predefinito per l'ordinamento, in questo modo non avrei bisogno di lottare tanto per creare le suite di test;)
FryAmTheEggman

Eccone altri 16, nel caso in cui ti dia qualche idea per ulteriori golf: retina.tryitonline.net/…
Martin Ender

4

Mathematica, 33 31 byte

Max@MinimalBy[#,IntegerLength]&

MinimalBy seleziona tutti gli elementi della lista di input originale con il punteggio più piccolo in base IntegerLength, cioè, con il numero più piccolo di cifre; e poi Max emette il più grande.

Grazie a Martin Ender per avermi trovato e salvato 2 byte per me :)


4

Perl 6 , 18 byte

*.min:{.chars,-$_}

Spiegazione:

*\        # Whatever lambda
.min:     # find the minimum using

{         # bare block lambda with implicit parameter 「$_」

  .chars, # number of characters first ( implicit method call on 「$_」 )
  -$_     # then negative of the value in case of a tie
}

Uso:

say [738, 2383, 281, 938, 212, 1010].&( *.min:{.chars,-$_} ); # 938

my &code = *.min:{.chars,-$_}

say code [78, 99, 620, 10]; # 99

3

Gelatina , 8 byte

DL€İMị¹Ṁ

Provalo online! oppure Verifica tutti i casi di test.

Spiegazione

DL€İMị¹Ṁ  Input: list A
D         Convert each integer to a list of base 10 digits
 L€       Get the length of each list (number of digits of each)
   İ      Take the reciprocal of each
    M     Get the indices of the maximal values
      ¹   Get A
     ị    Select the values at those indices from A
       Ṁ  Find the maximum and return

Come sono questi 8 byte? Tutti questi personaggi si adattano in ASCII?
Federico Poloni,

1
@FedericoPoloni Sì, si adattano , anche se in un'altra tabella codici.
Erik the Outgolfer,

3

JavaScript (ES6), 51

l=>l.sort((a,b)=>(a+l).length-(b+l).length||b-a)[0]

Test

f=l=>l.sort((a,b)=>(a+l).length-(b+l).length||b-a)[0]

;[
 [[1], 1]
,[[9], 9]
,[[1729], 1729]
,[[1, 1], 1]
,[[34, 3], 3]
,[[38, 39], 39]
,[[409, 12, 13], 13]
,[[11, 11, 11, 1], 1]
,[[11, 11, 11, 11], 11]
,[[78, 99, 620, 1], 1]
,[[78, 99, 620, 10], 99]
,[[78, 99, 620, 100], 99]
,[[1, 5, 9, 12, 63, 102], 9]
,[[3451, 29820, 2983, 1223, 1337], 3451]
,[[738, 2383, 281, 938, 212, 1010], 938]
].forEach(([l,x])=>{
  var r=f(l)
  console.log(r==x?'OK':'KO',l+' -> '+r)
})  


3

J, 21 14 byte

Risparmiato 7 byte grazie a miglia e (indirettamente) Jonathan!

{.@/:#@":"0,.-

Questa è una catena a quattro:

{.@/: (#@":"0 ,. -)

Camminiamo sopra l'input 10 27 232 1000. La forcella interna è composta da tre denti. #@":"0calcola le dimensioni, ,.concede ogni dimensione con il suo -elemento negato ( ). Per input 10 27 232 1000, ci resta questo:

   (#@":"0 ,. -) 10 27 232 1000
2   _10
2   _27
3  _232
4 _1000

Ora, abbiamo {.@/:come dente esterno. Questo è monadico first ( {.) su dyadic sort ( /:). Cioè, prenderemo il primo elemento del risultato di diadico /:. Questo ordina il suo argomento giusto in base al suo argomento sinistro, che ci dà per il nostro contributo:

   (/: #@":"0 ,. -) 10 27 232 1000
27 10 232 1000

Quindi, utilizzando {.ci fornisce il primo elemento di tale elenco e abbiamo finito:

   ({.@/: #@":"0 ,. -) 10 27 232 1000
27

Vecchia versione

>./@(#~]=<./@])#@":"0

Continuo a lavorare sui miglioramenti. Ho giocato a golf da 30, e penso che sia abbastanza buono. Ho intenzione di scomporlo per primo in parti di base:

   size =: #@":"0
   max =: >./
   min =: <./
   over =: @
   right =: ]
   left =: [
   selectMin =: #~ right = min over right

   f =: max over selectMin size
   f 3 4 5
5
   f 3 4 53
4
   f 343 42 53
53

Ecco come funziona.

>./@(#~ ] = <./@]) #@":"0

Questo è un treno monadico, ma questa parte è un gancio. Il verbo >./@(#~ ] = <./@])viene chiamato con argomento left come input per la catena principale e le dimensioni, definite come #@":"0, come argomento right. Viene calcolato come formato predefinito length ( #) over ( @) (": ), ovvero stringificazione numerica, che viene fatta applicare alle celle 0 (cioè membri) dell'input ( "0).

Camminiamo sull'input di esempio 409 12 13.

   (#@":"0) 409 12 13
3 2 2

Ora, per il verbo interiore, >./@(#~ ] = <./@]). Sembra >./@(...)che significhi effettivamente il massimo valore ( >./) di ( @) cosa c'è dentro (...). Per quanto riguarda l'interno, questo è un quattro treni, equivalente a questo cinque treni:

[ #~ ] = <./@]

[fa riferimento all'argomento originale e ]fa riferimento all'array size; 409 12 13e 3 2 2rispettivamente in questo esempio. Il dente giusto <./@], calcola la dimensione minima, 2in questo caso. ] = <./@]è una matrice booleana di valori pari al minimo, 0 1 1in questo caso. Infine, [ #~ ...prende i valori dall'argomento sinistro in base alla maschera dell'argomento destro. Ciò significa che gli elementi corrispondenti 0vengono eliminati e 1mantenuti. Quindi siamo rimasti con 12 13. Infine, secondo quanto sopra, viene preso il massimo, dandoci il risultato corretto di 13e abbiamo finito.


Alcuni shuffle e un hook possono salvare un byte >./@#~[:(=<./)#@":"0. Penso che ci potrebbe essere un po 'di più da salvare
miglia

@miles XD Ho appena finito di scrivere una spiegazione. Ah bene, fammi dare un'occhiata a questa bellezza ...
Conor O'Brien,

Jonathan ha trovato un metodo migliore. Se lo convertiamo in J, i suoi 14 byte {.@/:#@":"0,.-ma l'input deve essere modellato come un elenco
miglia

@miles "a forma di lista"? Vuoi dire, come 400 12 13?
Conor O'Brien,

2

JavaScript (ES6), 62 byte

var solution =

a=>a.map(n=>(l=`${n}`.length)>a?l>a+1|n<r?0:r=n:(a=l-1,r=n))|r

;document.write('<pre>' + `
[1] -> 1
[9] -> 9
[1729] -> 1729
[1, 1] -> 1
[34, 3] -> 3
[38, 39] -> 39
[409, 12, 13] -> 13
[11, 11, 11, 1] -> 1
[11, 11, 11, 11] -> 11
[78, 99, 620, 1] -> 1
[78, 99, 620, 10] -> 99
[78, 99, 620, 100] -> 99
[1, 5, 9, 12, 63, 102] -> 9
[3451, 29820, 2983, 1223, 1337] -> 3451
[738, 2383, 281, 938, 212, 1010] -> 938
`.split('\n').slice(1, -1).map(c =>
  c + ', result: ' + solution(eval(c.slice(0, c.indexOf('->'))))
).join('\n'))


2

dc, 54 byte

?dZsL0sN[dsNdZsL]su[dlN<u]sU[dZlL=UdZlL>ukz0<R]dsRxlNp

Spiegazione:

?dZsL0sN                  # read input, initialize L (length) and N (number)
[dsNdZsL]su               # macro (function) 'u' updates the values of L and N
[dlN<u]sU                 # macro 'U' calls 'u' if N < curr_nr
[dZlL=U dZlL>ukz0<R]dsR   # macro 'R' is a loop that calls 'U' if L == curr_nr_len
                          #or 'u' if L > curr_nr_len
xlNp                      # the main: call 'R' and print N at the end

Esegui esempio: "input.txt" contiene tutti i casi di test nell'istruzione della domanda

while read list;do echo "$list -> "$(dc -f program.dc <<< $list);done < input.txt

Produzione:

1 -> 1
9 -> 9
1729 -> 1729
1 1 -> 1
34 3 -> 3
38 39 -> 39
409 12 13 -> 13
11 11 11 1 -> 1
11 11 11 11 -> 11
78 99 620 1 -> 1
78 99 620 10 -> 99
78 99 620 100 -> 99
1 5 9 12 63 102 -> 9
3451 29820 2983 1223 1337 -> 3451
738 2383 281 938 212 1010 -> 938

2

Java 7, 112 104 byte

int c(int[]a){int i=a[0],j;for(int b:a)i=(j=(i+"").length()-(b+"").length())>0?b:b>i&j==0?b:i;return i;}

Approccio diverso per salvare più byte grazie a @ Barteks2x .

Casi non testati e test:

Provalo qui.

class M{
  static int c(int[] a){
    int i = a[0],
        j;
    for(int b : a){
      i = (j = (i+"").length() - (b+"").length()) > 0
           ? b
           : b > i & j == 0
              ? b
              : i;
    }
    return i;
  }

  public static void main(String[] a){
    System.out.println(c(new int[]{ 1 }));
    System.out.println(c(new int[]{ 9 }));
    System.out.println(c(new int[]{ 1729 }));
    System.out.println(c(new int[]{ 1, 1 }));
    System.out.println(c(new int[]{ 34, 3 }));
    System.out.println(c(new int[]{ 409, 12, 13 }));
    System.out.println(c(new int[]{ 11, 11, 11, 1 }));
    System.out.println(c(new int[]{ 11, 11, 11, 11 }));
    System.out.println(c(new int[]{ 78, 99, 620, 1 }));
    System.out.println(c(new int[]{ 78, 99, 620, 100 }));
    System.out.println(c(new int[]{ 1, 5, 9, 12, 63, 102 }));
    System.out.println(c(new int[]{ 3451, 29820, 2983, 1223, 1337 }));
    System.out.println(c(new int[]{ 738, 2383, 281, 938, 212, 1010 }));
  }
}

Produzione:

1
9
1729
1
3
13
1
11
1
99
9
3451
938

1
versione più corta: int c (int [] a) {int i = a [0], j; for (int b: a) i = (j = (i + ""). length () - (b + ""). lunghezza ())> 0? b: b> i & j == 0? b: i; return i;}
barteks2x

@ Barteks2x Grazie, l'ho modificato.
Kevin Cruijssen,

2

bash, awk, ordina 53 byte

set `awk '{print $0,length($0)}'|sort -rnk2n`;echo $1

Leggi l'input da stdin, un valore per riga

bash e ordina, 58 57 byte

set `sort -n`;while((${#2}==${#1}));do shift;done;echo $1


non funziona per l'ultimo campione dato 2383 anziché 938
Archemar il

@Archemar scusate ho letto male la domanda, ora è corretta
Emmanuel

È possibile rimuovere lo spazio tra whilee ((.
seshoumara,

1

JavaScript ES6, 80 77 70 byte

a=>Math.max(...a.filter(l=>l.length==Math.min(...a.map(i=>i.length))))

Spero di andare nella giusta direzione ...


Potresti sostituirlo a.map(i=>i.length).sort((a,b)=>a-b)[0]con Math.min(...a.map(i=>i.length))?
user81655

@ user81655 sì, posso. Pensavo di aver apportato quella modifica, ma a quanto pare non l'ho fatto
Downgoat

Potresti anche provare a negare il minimo in modo da poter riutilizzare Math.max: a=>(m=Math.max)(...a.filter(l=>l.length==-m(...a.map(i=>-i.length))))Sembra però salvare solo 1 byte.
user81655

Per un altro byte filterpuò essere sostituito con un valore mapche restituisce 0valori che non superano il test:a=>(m=Math.max)(...a.map(l=>l.length+m(...a.map(i=>-i.length))?0:l))
user81655

1

Brachylog , 16 byte

or:@]feL:la#=,Lh

Provalo online!

Spiegazione

or                 Sort the list in descending order.
  :@]f             Find all suffixes of the list.
      eL           Take one suffix L of the list.
        :la        Apply length to all numbers in that suffix.
           #=,     All lengths must be equal.
              Lh   Output is the first element of L.

1

Haskell, 39 byte

snd.maximum.map((0-).length.show>>=(,))

Questo non funziona, si preferisce 34a 2.
xnor

Oh, grazie. Devo ripensarlo ..
Damien,

Funziona meglio ora!
Damien,

1

Javascript (ES6), 57 54 53 byte

l=>l.sort((a,b)=>(s=a=>1/a+`${a}`.length)(a)-s(b))[0]

Per la cronaca, la mia versione precedente era più orientata alla matematica ma 1 byte più grande:

l=>l.sort((a,b)=>(s=a=>1/a-~Math.log10(a))(a)-s(b))[0]

Casi test

let f =
l=>l.sort((a,b)=>(s=a=>1/a+`${a}`.length)(a)-s(b))[0]

console.log(f([1]));                              //  -> 1
console.log(f([9]));                              //  -> 9
console.log(f([1729]));                           //  -> 1729
console.log(f([1, 1]));                           //  -> 1
console.log(f([34, 3]));                          //  -> 3
console.log(f([38, 39]));                         //  -> 39
console.log(f([409, 12, 13]));                    //  -> 13
console.log(f([11, 11, 11, 1]));                  //  -> 1
console.log(f([11, 11, 11, 11]));                 //  -> 11
console.log(f([78, 99, 620, 1]));                 //  -> 1
console.log(f([78, 99, 620, 10]));                //  -> 99
console.log(f([78, 99, 620, 100]));               //  -> 99
console.log(f([1, 5, 9, 12, 63, 102]));           //  -> 9
console.log(f([3451, 29820, 2983, 1223, 1337]));  //  -> 3451
console.log(f([738, 2383, 281, 938, 212, 1010])); //  -> 938


1

MATL , 11 byte

tV48\&XS0))

L'input è un vettore di colonna (che utilizza ;come separatore), ad esempio

[78; 99; 620; 100]

Provalo online! Oppure verifica tutti i casi di test .

Spiegazione

Usiamo l'input [78; 99; 620; 100]come esempio.

t      % Input column vector implicitly. Duplicate
       %   STACK: [78; 99; 620; 100], [78; 99; 620; 100]
V      % Convert to string. Each number is a row, left-padded with spaces
       %   STACK: [78; 99; 620; 100], [' 78'; ' 99'; '620'; '100']
48\    % Modulo 48. This transforms each digit into the corresponding number,
       % and space into 32. Thus space becomes the largest "digit"
       %   STACK: [78; 99; 620; 100], [32 7 8; 32 9 9; 6 2 0; 1 0 0]
&XS    % Sort rows in lexicographical order, and push the indices of the sorting
       %   STACK: [78; 99; 620; 100], [4; 3; 1; 2]
0)     % Get last value
       %   STACK: [78; 99; 620; 100], 2
)      % Index
       %   STACK: 99
       % Implicitly display

1
Bello vedere gli stati dello stack nella tua spiegazione!
Flawr,

1

Perl, 38 37 byte

Include +1 per -a

Dare input su STDIN:

perl -M5.010 maxmin.pl <<< "3451 29820 2983 1223 1337"

maxmin.pl:

#!/usr/bin/perl -a
\$G[99-y///c][$_]for@F;say$#{$G[-1]}

Utilizza la memoria lineare nel numero più grande, quindi non provarlo su numeri troppo grandi. Una soluzione senza quel difetto è di 38 byte:

#!/usr/bin/perl -p
$.++until$\=(sort/\b\S{$.}\b/g)[-1]}{

Tutti questi sono molto imbarazzanti e non si sentono affatto ottimali ...


1

R, 72 41 36 byte

Riscritta la funzione con un nuovo approccio. Golfato 5 byte grazie a un suggerimento di @bouncyball.

n=nchar(i<-scan());max(i[n==min(n)])

Ha spiegato:

        i<-scan()       # Read input from stdin
n=nchar(         );     # Count the number of characters in each number in i
max(             )      # Return the maximum of the set where
    i[n==min(n)]        # the number of characters is the minimum number of characters.

function(i){while(1){if(length(o<-i[nchar(i)==T]))return(max(o));T=T+1}}

Frastagliata / spiegato:

function(i){               # Take an input i
  while(1){                # Do the following continuously:
    if(length(
        o<-i[nchar(i)==T]) # Define o to be the subset of i with numbers of length T,
      )                    # where T is 1 (a built-in!).
                           # We take the length of this subset (its size), and then pass
                           # it to if(). Thanks to weak typing, this numeric is converted
                           # to a logical value. When this occurs, zero evaluates to FALSE
                           # and any non-zero number evaluates to TRUE. Therefore, the if()
                           # is TRUE iff the subset is not empty.
      return(max(o));      # If it's true, then we just return the largest element of the
                           # subset, breaking out of our loop.
    T=T+1                  # Otherwise, increment our counter and continue.
  }
}


1
Salva 4 byte non definendo function:i=scan();n=nchar(i);max(i[n==min(n)])
bouncyball

@bouncyball Grazie! E 1 ulteriore byte salvato da n=nchar(i<-scan()).
rturnbull,

1

Bash + coreutils, 58 byte

d=`sort -n`;egrep ^.{`sed q<<<"$d"|wc -L`}$<<<"$d"|tail -1

Il formato di input è un valore per riga. Suggerimenti di golf sono i benvenuti.

Spiegazione:

d=`sort -n`                             #save the list in ascending numerical order
egrep ^.{                    }$<<<"$d"  #print only list lines having as many chars
         `sed q<<<"$d"|wc -L`                 #as the first sorted line does
|tail -1                                #and then get the last one (the answer)

+1 grazie ora so che sed q=head -1
Emmanuel,

1

Python 2 - 41 byte

lambda l:max((-len(`x`),x) for x in l)[1]

0

Python 2, 58 byte

def F(x):l={len(`i`):i for i in sorted(x)};print l[min(l)]

0

Python 3, 56 byte

lambda a:sorted(sorted(a),key=lambda x:-len(str(x)))[-1]

Usa una lambda in una lambda!

Python 2, 53 byte

s=lambda a:sorted(sorted(a),key=lambda x:-len(`x`))[-1]

Lo stesso ma con le punte posteriori


0

Pip , 11 byte

(SNgSK-#_v)

Accetta input come argomenti della riga di comando. Provalo online!

La prima volta che usi l' operatore Sattento K! Come Python sorted(), accetta una funzione che viene applicata a ciascun elemento dell'iterabile e il risultato utilizzato come chiave di ordinamento. Ecco come funziona questo programma:

 SNg         List of cmdline args, sorted numerically in increasing order
    SK       Sort with key function...
      -#_    ... negative length(x), thus putting the shortest numbers at the end but not
               affecting the relative ordering among numbers with the same length
(        v)  Get the last element (index -1) and auto-print

0

Clojure, 63 byte

(reduce #(if(=(quot %1 10)(quot %2 10))(max %1 %2) %1)(sort x)) 

come in:

(reduce #(if(=(quot %1 10)(quot %2 10))(max %1 %2) %1)(sort[3 7 121 11 8 2 10 9]))
=> 9

Anche se sono sicuro che c'è un modo per ridurlo.


0

PHP, 86 byte

<?$l=strlen($r=min($a=$_GET[a]));foreach($a as$v)if($v>$r&strlen($v)==$l)$r=$v;echo$r;
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.