Самый короткий путь от Николаевки до Сергеевки и от Сергеевки до Ивановки = 3+3=6
S, a - должны быть целочисленными, а не вещественными.
Program Summa;
Uses Crt;
var s,n,c:integer;
begin
clrscr;
write('Введите числа коннц ввода 0: ');
s:=0;c:=0;
repeat
readln(n);
c:=c+1;
if (n mod 2)=0 then
if ((n>=5)and (n<=25)) then s:=s+n;
until (n=0) or (c=1000) ;
write('Сумма ',c,' чётных чисел в диапазоне от 5 до 25:',s);
readkey;
end.
:D
Даю 2 варианта:
1)
#include <iostream>#include <list>using namespace std;
int main() { int n, t; cin >> n; list<int> li; for (int i = 0; i < n; i++) { cin >> t; li.push_back(t); } li.sort(); li.unique(); cout << li.size() << endl; return 0;}
2)
#include <iostream>#include <set>using namespace std;
int main() { int n, t; cin >> n; set<int> se; for (int i = 0; i < n; i++) { cin >> t; se.insert(t); } cout << se.size() << endl; return 0;}