ответ:я не уверена в ответах(давно не решала такие задачи)
16
[29, 31]
[28, 30]
12
[21, 23]
[20, 22]
Объяснение:
def moves(heap):
a,b=heap
return[(a+1,b),(2*a,b),(a,b+1),(a,b*2)]
table={(k,s):0 for k in range(501)for s in range(501)}
for x in table:
if any(sum(t)>=69 for t in moves(x)):
table[x]=1
if table[x]==0 and all(table[t]==1 for t in moves(x)):
table[x]=2
if table[x]==0 and any(table[t]==2 for t in moves(x)):
table[x]=3
if table[x]==0 and all(table[t]==3 or table[t]==1 for t in moves(x)):
table[x]=4
print(min([s for s in range(1,118)if any(table[t]==1 for t in moves((5,s)))]))
print([s for s in range(1,118)if table[(5,s)]==3])
print([s for s in range(1,118)if table[(5,s)]==4])
if any(sum(t)>=53 for t in moves(x)):
ответ:я не уверена в ответах(давно не решала такие задачи)
16
[29, 31]
[28, 30]
12
[21, 23]
[20, 22]
Объяснение:
def moves(heap):
a,b=heap
return[(a+1,b),(2*a,b),(a,b+1),(a,b*2)]
table={(k,s):0 for k in range(501)for s in range(501)}
for x in table:
if any(sum(t)>=69 for t in moves(x)):
table[x]=1
for x in table:
if table[x]==0 and all(table[t]==1 for t in moves(x)):
table[x]=2
for x in table:
if table[x]==0 and any(table[t]==2 for t in moves(x)):
table[x]=3
for x in table:
if table[x]==0 and all(table[t]==3 or table[t]==1 for t in moves(x)):
table[x]=4
print(min([s for s in range(1,118)if any(table[t]==1 for t in moves((5,s)))]))
print([s for s in range(1,118)if table[(5,s)]==3])
print([s for s in range(1,118)if table[(5,s)]==4])
def moves(heap):
a,b=heap
return[(a+1,b),(2*a,b),(a,b+1),(a,b*2)]
table={(k,s):0 for k in range(501)for s in range(501)}
for x in table:
if any(sum(t)>=53 for t in moves(x)):
table[x]=1
for x in table:
if table[x]==0 and all(table[t]==1 for t in moves(x)):
table[x]=2
for x in table:
if table[x]==0 and any(table[t]==2 for t in moves(x)):
table[x]=3
for x in table:
if table[x]==0 and all(table[t]==3 or table[t]==1 for t in moves(x)):
table[x]=4
print(min([s for s in range(1,118)if any(table[t]==1 for t in moves((5,s)))]))
print([s for s in range(1,118)if table[(5,s)]==3])
print([s for s in range(1,118)if table[(5,s)]==4])
using System;
class Program
{
static void Main()
{
int x1 = 2, y1 = 1;
int x2 = 6, y2 = 5;
int x3 = 10, y3 = 1;
var a = Distance(x2, y2, x3, y3);
var b = Distance(x1, y1, x3, y3);
var c = Distance(x2, y2, x1, y1);
Console.WriteLine("S = {0}", Square(a, b, c));
Console.ReadKey();
}
//растояние между точками
static double Distance(int x1, int y1, int x2, int y2)
{
return Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
//формула герона
static double Square(double a, double b, double c)
{
var p = (a + b + c) / 2;
return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
}
// теорема косинусов
static double Angle(double a, double b, double c)
{
return Math.Acos((b * b + c * c - a * a) / (2 * b * c));
}
static bool IsAcuteAngel(double alpha)
{
return alpha < Math.PI / 2;
}
}