Problem 2 (only c++)
1 second
256 megabytes
everyone is afraid of something. someone is afraid of darkness, someone is afraid of heights, someone is afraid of public toilets (all of us are afraid of public toilets), someone is afraid of debts… there are many fears, but the greatest among all for unknown_user2019 is choosing a land for planting strawberries. unknown_user2019's land can be described as a matrix with n rows and m columns. some of the fields in the matrix are suitable for planting strawberries and some are not – weeds grow there. unknown_user2019 is looking for rectangular parts of the land that are completely filled with fields suitable for strawberry planting. those kinds of rectangles are called suitable rectangles. also, unknown_user2019 is interested in the potential value of all fields in the matrix. the potential value of each field in the matrix is defined as the number of suitable rectangles that contain that field. since unknown_user2019 has troubles facing his fears, he asks you to only calculate the sum of all the fields' potential values. input the first line contains two positive integers n and m (1 ≤ n, m ≤ 2 000), dimensions of the land. the next n lines contains m characters each, representing the landscape. each character can be either a ‘.’ (dot) which represents a field suitable for planting or a ‘#’ which represents weeds. output output the sum of all potential values of the matrix’s fields.
scoring in test cases worth 20% of the total points, it will hold that 1 ≤ n, m ≤ 10. in test cases worth additional 30% of the total points, it will hold that 1 ≤ n, m ≤ 300.
input
2 3 .#. .#
output
8
input
3 3
output
100
input
3 4 ..#. # #
output
40
clarification of the first sample test: the following matrix describes the potential values of the land’s fields. the sum of all potential values is 8.
2 0 1
3 2 0
Практическая работа
Тема: Построение графиков функций в Excel 2010
Задание 1. Построить график функции y=x2 на отрезке [-5; 5] с шагом 0,5hello_html_m7434b05.png
Составить таблицу значений (Рисунок 1)
Выделите диапазон ячеек значений y и выполните команду Вставка – График.
Откройте Вкладку Работа с диаграммами Макет Название диаграммы График функции y=x2
Щелкните по области построения диаграммы, Выбрать данные – Подписи горизонтальной оси (категории) –Изменить- выделить диапазон А3:А23 (Рисунок 2)hello_html_m46c52806.png
Выберите Ряд Изменить - Имя ряда y=x^2 - Ок
Не снимая выделения с диаграммы выберите вкладку Макет – Названия осей –название горизонтальной оси – название под осью-x. Аналогично внесите название оси y.
hello_html_mfc27ecf.png
Рисунок 3 - Название графика
Выделите двойным щелчком мыши линию графика, правой кнопкой мыши -Формат ряда данных- тип линии- сглаженная линия.
hello_html_m1a8e5315.png
Формат ряда данных
Перенесите ось y в точку 0. Для этого выполните команду Макет- Оси-Горизонтальная ось - Дополнительные параметры горизонтальной оси -
hello_html_m74b02b75.png
– Дополнительные параметры основной горизонтальной оси
Вертикальная ось пересекает в категории номер 11, Положение оси по делениям
Самостоятельно измените цвет линии графика и формат области диаграммы выбрав Градиентную заливку.
Самостоятельно аналогично выполните задания:
Задание 2. Построить график функции y=x3 на отрезке [-3; 3] с шагом 0,5
Задание 3. Построить график функции y=cosx на отрезке [-3; 3] с шагом 0,5
Задание 4. Построить график функции y=2sin3x на отрезке [-3; 3] с шагом 0,5
Задание 5. Решите графически с уравнение 2x2=2x+4
Объяснение:
n, i, prev: integer;
function IsSimpleNumber(n: integer): boolean;
var
i: integer;
begin
IsSimpleNumber := true;
for i := 2 to round(sqrt(n) + 1) do
if n mod i = 0 then begin
IsSimpleNumber := false;
exit;
end;
end;
begin
read(n);
prev := 0;
for i := n to 2 * n do
if IsSimpleNumber(i) then
if prev = 0 then
prev := i
else if i - prev = 2 then begin
writeln(i, ', ', prev, ' - близнецы');
halt;
end
else prev := i;
writeln('Близнецов нет');
end.