Learn DSADSAContests
coding75 logo
LeetCode POTDPOTDSheets
coding75 Pro
coding75 logo
Dashboard
Learn DSA
Course RoadmapFlow
DSA Topic TreeNew 🚀
Contest SolutionsPractice
Practice Sheets
MasterclassesLive 👨🏻‍💻

coding75 ProPRO

Live Classes & Placement Guidance

coding75 logo

The premier developer platform for mastering Data Structures & Algorithms, exploring contest editorials, building ATS-ready resumes, and accelerating your tech career.

Connect & Community

DSA & Contests

  • Learn DSA
  • Contest Solutions
  • LeetCode POTDDaily
  • Practice Sheets
  • MasterclassesSoon

Interview Prep

  • Portfolio Projects
  • CS Fundamentals
  • System DesignSoon
  • Interview ExperiencesSoon
  • Mock InterviewsSoon

Career & Pro

  • Jobs & Internships
  • Resume BuilderATS
  • coding75 Pro
  • Submit Feedback
© 2026coding75•crackDSA™•Maa Lalita Edtech Private Limited. All Rights Reserved.
Privacy PolicyTerms & ConditionsContact Support
Registered Office: Kanpur 208021•Regional Office: Indiranagar, Bangalore, 560008
Maa Lalita Edtech Private Limited
Contests/CodeChef/Starters 207/Gambling
Next
CodeChefCodeChef
1 Star
Starters 207

Gambling

Math
Loading...
Solve on CodeChef

Problem Statement

Official algorithmic problem description and constraints.

Open on CodeChef

Despite everyone's advice, Chef has decided to gamble away his money.


Today he chose a dice game to bet on. Chef will roll 2


2 die one after the other, and Chef wins if and only if the sum of the 2


2 dice rolls is exactly 7


7.

The die are standard fair 6


6-faced, with numbers 1


1 through 6


6 written on the sides.

Chef's first roll turned up to be the number A


A. What number does Chef need on his second roll to win the game? It can be proven that this number exists and is unique.

Input Format

  • The first and only line of input contains a single integer A

  • A.

Output Format

Output the required dice roll on the 2nd


2nd

 dice for Chef to win the game.

Constraints

  • 1≤A≤6

  • 1≤A≤6

Sample 1:

Input


Output


1
6

Explanation:

Chef got a 1


1 on his first roll, so he needs 7−1=6


7−1=6 on his second roll.

Did you like the problem statement?

34 users found this helpful

More Info

Time limit1 secs


Memory limit1.5 GB

Source Limit50000 Bytes


Solutions & Walkthrough

Detailed video explanations, mathematical intuition, and clean C++ implementation code.

Connecting secure classroom stream...
Back to Starters 207
Next Problem