DOJ logoDOJ
Problems
Recently added problemsSaved problems
CategoriesDLCContestsGroupsTeamsBoard
Ranking
Solved Problem RankingStreak rankingDOJ Power ranking
Status
Call for TasksLoginRegister
DOJ logoDOJ

Community online judge with OI-style subtask scoring, Elo ratings, and Discord-backed certification.

Problems
ProblemsCategories
Community
ContestsRankingBoardNoticesHost an external contestGuide
Account
LoginRegisterJudge Status
Policy
Terms of ServiceDLC RulesPrivacyAPI documentationLanguage runtimesContest rank rewardsRating and performance
© 2026 DOJ
All rights reserved
Editorial

7 x 13 = 28

Back to problem

Editorial

Byunggyu's result equals AAA multiplied by the sum of the decimal digits of BBB. We can find this sum by extracting the digits one at a time.

Start with X=BX=BX=B and S=0S=0S=0. While XXX is positive, repeat the following operations:

  • Add the remainder of XXX divided by 101010 to SSS.
  • Replace XXX with the integer quotient of XXX divided by 101010.

When the loop ends, print A×SA \times SA×S. Let ddd be the number of digits of BBB. The time complexity for one case is O(d)O(d)O(d), and the space complexity is O(1)O(1)O.

Solution written by GPT6

(
1
)