#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
using namespace std;
class pacient {
private:
string lastName_m, mOrFM_m, adress_m, diagnosis_m;
public:
pacient(string lastName = "", string mOrFM = "", string adress = " ", string diagnosis = " ") {
lastName_m = lastName;
mOrFM_m = mOrFM;
adress_m = adress;
diagnosis_m = diagnosis;
}
string getLastName() {
return lastName_m;
}
string getAll() {
return lastName_m + ", " + mOrFM_m + ", " + adress_m + ", " + diagnosis_m + ".";
}
};
int main() {
fstream out("output.txt");
setlocale(LC_ALL, "Russian");
vector<pacient> arr;
for(int i = 0;;++i) {
string a[4];
for(int j = 0; j<4; ++j) {
switch(j) {
case 0: cout << "Last name: "; break;
case 1: cout << "Male or FeMale: "; break;
case 2: cout << "Adress: "; break;
case 3: cout << "Diagnosis: "; break;
}
getline(cin, a[j]);
}
pacient temp(a[0], a[1], a[2], a[3]);
cout << "Для окончания ввода введите 1: ";
arr.push_back(temp);
string temp1;
getline(cin, temp1);
if(temp1=="1") {
break;
}
}
for(int j = 0; j<1000; ++j) {
for(int i = 0; i<arr.size()-1; ++i) {
if(arr[i].getLastName()[0]>arr[i+1].getLastName()[0]) {
swap(arr[i], arr[i+1]);
}
} }
for(int i = 0; i<arr.size(); ++i) {
cout << arr[i].getLastName() << endl;
out << arr[i].getAll();
out << "\n";
}
out.close();
}
Program A;
var
N,K,M,M1,i:byte;
P,P1,H:integer;
t:0..1;
begin
readln(N,K,M);
for i:=1 to N do
begin
read(P);
P1:=P;
M1:=0;
t:=0;
if i mod K = 0 then
while P>0 do
begin
M1:=M1+P mod 10;
P:=P div 10;
end;
if M1=M then
t:=1;
if t=0 then
H:=H+P1;
end;
write(H);
end.