n = float(input('С какой скоростью шли богатыри? '))
r = float(input('Какое расстояние им предстоит преодолеть? '))
print('Время в пути (в минутах): ' + str(r/n))
Ответ:
#include <iostream>
#include <algorithm>
#include <cmath>
int gcd(int a, int b){
a = std::abs(a);
b = std::abs(b);
while(b > 0){
a %= b;
std::swap(a, b);
}
return a;
}
int main(){
int a, b;
std::cin >> a >> b;
int g = gcd(a, b);
std::cout << g << std::endl;
return 0;
}
Int A[6];
bool B = false;
for(int i = 0; i < sizeof(A); i++) {
A[i] = random(6);
if(i > 0 && A[i-1] == A[i])
B = true;
}
cout << "Массив: " << A[0] << A[1] << A[2] << A[3] << A[4] << A[5] << endl;
if(B == true)
cout << "Есть" << endl;
else
cout << "Нет" << endl;
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
double a = 2.1;
double b = 5.3;
double c = 1.4;
double x;
cin >> x;
double y = (sqrt(exp(2 * x + b)) - 1.7 * cos(c * x)) / (log(x * x + a)) + x * x * x;
cout << "y=" << y;
cout << setprecision(2) << fixed;
cout << "\nx=" << x << " y=" << y;
return 0;
}
#include <iostream>
using namespace std;
int main() {
int m=6;
int n=12;
int k=0;
char chars[m][n];
string st[m] = {
"###...??..+.",
"###.=.??..+.",
"###.......+.",
".....???....",
"???.......==",
"???...####.."
};
for (int i=0;i<m;i++){
for (int j=0; j<n; j++) {
chars[i][j] = st[i][j];
cout << chars[i][j];
}
cout << "\n";
}
if (chars[0][0] != '.') k++;
for (int j=1; j<n; j++)
if ((chars[0][j] !='.')&&(chars[0][j-1] != chars[0][j])) k++;
for (int i=1;i<m;i++){
if ((chars[i][0] != '.')&&(chars[i-1][0] != chars[i][0])) k++;
for (int j=1; j<n; j++)
if ((chars[i][j] !='.')&&
(chars[i][j-1] != chars[i][j])&&
(chars[i-1][j] != chars[i][j])) k++;
}
cout << k;
return 0;
}
Результат (для данного примера):
###...??..+.
###.=.??..+.
###.......+.
.....???....
???.......==
???...####..
8