Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя RHandarov

Автор RHandarov, история, 7 лет назад, По-английски

Hi Codeforces, I ask for help. Can I make a variable which is int type, but when it overflow, it convert to long long type. For example I make an integer variable x. I give max integer value on x. When I add 1 to x, I do not want to overflow. I want to make ( auto convert to) long long and continue with next number. Is it possible? I am sorry if I ask a stupid question.

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

just create the variable as a long long instead of as an int. You can do everything in the same way as with an int.