Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 36,484 MiB 0,000 s OK
#2 5/5 34,641 MiB 0,000 s OK
#3 5/5 36,336 MiB 0,000 s OK
#4 5/5 36,637 MiB 0,000 s OK
#5 5/5 35,137 MiB 0,000 s OK
#6 5/5 35,090 MiB 0,000 s OK
#7 5/5 41,418 MiB 0,000 s OK
#8 5/5 36,848 MiB 0,000 s OK
#9 6/6 33,102 MiB 0,000 s OK
#10 6/6 36,043 MiB 0,000 s OK
#11 6/6 33,988 MiB 0,000 s OK
#12 6/6 36,406 MiB 0,000 s OK
#13 6/6 34,406 MiB 0,000 s OK
#14 6/6 35,797 MiB 0,000 s OK
#15 6/6 33,363 MiB 0,000 s OK
#16 6/6 36,043 MiB 0,000 s OK
#17 6/6 36,586 MiB 0,000 s OK
#18 6/6 37,875 MiB 0,000 s OK

Ocenjevani program (Sveti_Gral.java):
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Vector;


public class Sveti_Gral {
	public static void main(String[] args)  throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String m = n + "";
		String[] m2 = m.split("");
		int dolzina = (m2.length)*9;
		int stevec = 0;
		Vector<Integer> shramba = new Vector<Integer>();
		
		for (int i = n-dolzina; i < n; i++) {
			if (i < 0) {
				i = 0;
			}
			String stringI = (i + "");
			String[] arrayI = stringI.split("");
			//System.out.println(i);
			int rez = i;
			for (int j = 0; j < arrayI.length; j++) {
				rez+= Integer.parseInt(arrayI[j]);
			}
			if (rez == n) {
				stevec +=1;
				shramba.add(i);
			}
		}
		System.out.println(stevec);
		for(int i = 0; i < shramba.size(); i++) {
			System.out.println(shramba.get(i));
		}
	}
}