Rezultati

Up. imeNalogaJezikRezultatČas oddaje
kkrsnik Hierarhija Java 100/100OK 11. maj '17 @ 17:47

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 37,340 MiB 0,000 s OK
#2 10/10 34,754 MiB 0,000 s OK
#3 10/10 41,906 MiB 0,000 s OK
#4 10/10 36,805 MiB 0,000 s OK
#5 10/10 39,516 MiB 0,000 s OK
#6 10/10 39,371 MiB 0,000 s OK
#7 10/10 33,223 MiB 0,000 s OK
#8 10/10 35,898 MiB 0,000 s OK
#9 10/10 36,383 MiB 0,000 s OK
#10 10/10 36,992 MiB 0,000 s OK

Ocenjevani program (Naloga3.java):
import java.util.Scanner;
public class Naloga3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        boolean enaka=n==k;
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < k; i++) {
            sb.append("1");
            if(!(enaka&&i==k-1))
                sb.append(" ");
        }
        for (int i = k+1; i < n; i++) {
            sb.append(i);
            if(i!=n-1)
                sb.append(" ");
        }
        System.out.println(sb.toString());
    }
}