program a2;
var
a, x1, y1, z1, l1, z, l: string;
i, g, d, f, a1, b1, sum, vr, vr1, err: int64;
begin
readln(a);
g := pos(';', a);
x1 := copy(a, 2, g - 2);
y1 := copy(a, g + 2, length(a) - g - 2);
if a[1] = '[' then d := 1
else d := 0;
if a[length(a)] = ']' then f := 1
else f := 0;
if pos('/', x1) <> 0 then begin
z := copy(x1, 1, pos('/', x1) - 1);
z1 := copy(x1, pos('/', x1) + 1, length(x1) - pos('/', x1));
val(z, vr, err);
val(z1, vr1, err);
a1 := vr div vr1;
end
else val(x1, a1, err);
if pos('/', y1) <> 0 then begin
l := copy(y1, 1, pos('/', y1) - 1);
l1 := copy(y1, pos('/', y1) + 1, length(y1) - pos('/', y1));
val(l, vr, err);
val(l1, vr1, err);
b1 := vr div vr1;
else val(y1, b1, err);
for i := a1 to b1 do sum := sum + 1;
if (d = 0) then
if vr = 0 then sum := sum - 1
else if (vr mod vr1 = 0) then sum := sum - 1;
if (f = 0) then
writeln(sum);
end.
На не благодари)
Вопрос скорее будет звучать "как много могли съесть толстяки?".
#include <iostream>
using namespace std;
int main() {
int multiplier = 1;
float weightCake = 0;
float t1(0), t2(0), t3(0);
float t1Cakes(0), t2Cakes(0), t3Cakes(0);
cout << "Weight of cake, fat people 1-3: ";
cin >> weightCake; cin >> t1; cin >> t2; cin >> t3;
while(1) {
t1Cakes = multiplier * weightCake * 1;
if(t1Cakes > t1/2) {
cout << multiplier - 1;
break;
}
t2Cakes = multiplier * weightCake * 2;
if(t2Cakes > t2/2) {
t3Cakes = multiplier * weightCake * 4;
if(t3Cakes > t3/2) {
++multiplier;
program a2;
var
a, x1, y1, z1, l1, z, l: string;
i, g, d, f, a1, b1, sum, vr, vr1, err: int64;
begin
readln(a);
g := pos(';', a);
x1 := copy(a, 2, g - 2);
y1 := copy(a, g + 2, length(a) - g - 2);
if a[1] = '[' then d := 1
else d := 0;
if a[length(a)] = ']' then f := 1
else f := 0;
if pos('/', x1) <> 0 then begin
z := copy(x1, 1, pos('/', x1) - 1);
z1 := copy(x1, pos('/', x1) + 1, length(x1) - pos('/', x1));
val(z, vr, err);
val(z1, vr1, err);
a1 := vr div vr1;
end
else val(x1, a1, err);
if pos('/', y1) <> 0 then begin
l := copy(y1, 1, pos('/', y1) - 1);
l1 := copy(y1, pos('/', y1) + 1, length(y1) - pos('/', y1));
val(l, vr, err);
val(l1, vr1, err);
b1 := vr div vr1;
end
else val(y1, b1, err);
for i := a1 to b1 do sum := sum + 1;
val(z, vr, err);
val(z1, vr1, err);
if (d = 0) then
if vr = 0 then sum := sum - 1
else if (vr mod vr1 = 0) then sum := sum - 1;
val(l, vr, err);
val(l1, vr1, err);
if (f = 0) then
if vr = 0 then sum := sum - 1
else if (vr mod vr1 = 0) then sum := sum - 1;
writeln(sum);
end.
На не благодари)
Вопрос скорее будет звучать "как много могли съесть толстяки?".
#include <iostream>
using namespace std;
int main() {
int multiplier = 1;
float weightCake = 0;
float t1(0), t2(0), t3(0);
float t1Cakes(0), t2Cakes(0), t3Cakes(0);
cout << "Weight of cake, fat people 1-3: ";
cin >> weightCake; cin >> t1; cin >> t2; cin >> t3;
while(1) {
t1Cakes = multiplier * weightCake * 1;
if(t1Cakes > t1/2) {
cout << multiplier - 1;
break;
}
t2Cakes = multiplier * weightCake * 2;
if(t2Cakes > t2/2) {
cout << multiplier - 1;
break;
}
t3Cakes = multiplier * weightCake * 4;
if(t3Cakes > t3/2) {
cout << multiplier - 1;
break;
}
++multiplier;
}
}