Rezultati

Up. imeNalogaJezikRezultatČas oddaje
pridnerozice-2018 Sveti gral Java 100/100OK 10. maj '18 @ 16:37

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 35,375 MiB 0,000 s OK
#2 5/5 37,082 MiB 0,000 s OK
#3 5/5 39,195 MiB 0,000 s OK
#4 5/5 37,195 MiB 0,000 s OK
#5 5/5 39,355 MiB 0,000 s OK
#6 5/5 36,195 MiB 0,000 s OK
#7 5/5 37,984 MiB 0,000 s OK
#8 5/5 39,414 MiB 0,000 s OK
#9 6/6 38,863 MiB 0,000 s OK
#10 6/6 34,363 MiB 0,000 s OK
#11 6/6 38,648 MiB 0,000 s OK
#12 6/6 36,348 MiB 0,000 s OK
#13 6/6 36,465 MiB 0,000 s OK
#14 6/6 36,676 MiB 0,000 s OK
#15 6/6 38,848 MiB 0,000 s OK
#16 6/6 35,273 MiB 0,000 s OK
#17 6/6 37,016 MiB 0,000 s OK
#18 6/6 36,461 MiB 0,000 s OK

Ocenjevani program (Gral.java):
import java.util.*;

class Gral{
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> x = new ArrayList<Integer>();
	int zac = n - 82;
	if( zac < 1) zac = 1;
        for(int i = zac; i < n; i++){
            int vsota = i;
            int tmp = i;
            while(tmp > 0){
                vsota += tmp%10;
                tmp /= 10;
            }

            if(vsota == n){
                x.add(i);
            }
        }
        System.out.println(x.size());
        for(int j = 0; j < x.size(); j++){
            System.out.println(x.get(j));
        }

    }
}