• =============================================================================

    question img

Ответы 2

  • // PascalABC.NET 3.2, сборка 1377 от 19.01.2017// Внимание! Если программа не работает, обновите версию!begin  var n:integer;  repeat    n:=ReadInteger;    if n>0 then begin      var d:=false; // нужны цифры      var a:=false; // нужны буквы      repeat        var r:=n mod 16;        if r in [0..9] then d:=true        else a:=true;        n:=n div 16      until (d and a) or (n=0);      if a and d then Writeln(3)      else        if a then Writeln(1)        else Writeln(2);      n:=-1 // чтобы из цикла не выйти      end  until n=0end.Пример131151922730
    • Автор:

      skyler16
    • 5 лет назад
    • 0
  • #include <iostream>using namespace std;int main() {  int n = -1;  while(!n) {    int numbers = 0, letters = 0;    cin >> n;    for(; !n || (numbers && letters); n/=16) {       if(n%16 < 10) numbers = 1;       else letters = 1;     }    if(numbers&&letters) cout << 3 << endl;    else if(numbers) cout << 1 << endl;    else if(letters) cout << 2 << endl;  }}     
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years