Код:
using System;namespace ThisAnswerIsNotMine { class Program { private static int a; private static int b; private static int c; private static int d; private static void Main() { int.TryParse(Console.ReadLine()!, out a); int.TryParse(Console.ReadLine()!, out b); int.TryParse(Console.ReadLine()!, out c); int.TryParse(Console.ReadLine()!, out d); Console.WriteLine((a / c) * (b / d) >= (b / c) * (a / d) ? "Широкая" : "Узкая"); } }}
С++14
Код:
#include <iostream>#include <iomanip>#include <string>#include <algorithm> size_t count_char(const std::string& number, char c) { return std::count(number.begin(), number.end(), c);} bool is_it_more_than(const std::string& number, char a, char b) { return count_char(number, a) > count_char(number, b);}int main() { long long k = 4353621ll; char a = '3'; char b = '4'; std::string number = std::to_string(k); std::cout << "Number is " << number << std::endl; std::cout << "a = " << a << std::endl; std::cout << "b = " << b << std::endl; std::cout << "Does a appear in Number more often than b: " << std::boolalpha << is_it_more_than(number, a, b) << std::endl; return 0;}