Rezultati

Up. imeNalogaJezikRezultatČas oddaje
functor2018 Sveti gral C++ 100/100OK 10. maj '18 @ 17:13

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 2,598 MiB 0,000 s OK
#2 5/5 2,590 MiB 0,000 s OK
#3 5/5 2,598 MiB 0,000 s OK
#4 5/5 2,598 MiB 0,000 s OK
#5 5/5 2,598 MiB 0,000 s OK
#6 5/5 2,652 MiB 0,000 s OK
#7 5/5 2,598 MiB 0,004 s OK
#8 5/5 2,652 MiB 0,000 s OK
#9 6/6 2,598 MiB 0,000 s OK
#10 6/6 2,598 MiB 0,000 s OK
#11 6/6 2,590 MiB 0,000 s OK
#12 6/6 2,598 MiB 0,000 s OK
#13 6/6 2,590 MiB 0,000 s OK
#14 6/6 2,586 MiB 0,000 s OK
#15 6/6 2,598 MiB 0,000 s OK
#16 6/6 2,648 MiB 0,000 s OK
#17 6/6 2,648 MiB 0,004 s OK
#18 6/6 2,590 MiB 0,000 s OK

Ocenjevani program (svetigral.cpp):
#include<stdio.h>
#include<vector>

using namespace std;

int sum(int n) {
  	int s = 0;
	while (n != 0) {
		s += n % 10;
		n = n / 10;
	}
	return s;
}

int main(){
  int n, s = 0;
  vector<int> stevila;
  scanf("%d", &n);
  for (int i = n-82; i < n; ++i) {
	if (i + sum(i) == n) {
		s++;
		stevila.push_back(i);
	}
  }
  printf("%d\n", s);
  for (auto it = stevila.begin(); it != stevila.end(); ++it) {
	printf("%d\n", *it);
  }
  return 0;
}