Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8544937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:40:49+00:00 2026-06-11T12:40:49+00:00

I am trying to solve this exercise, It seems easy this , but I

  • 0

I am trying to solve this exercise, It seems easy this, but I can not understand the contraints -rules, It says:

  1. the number may be represented on one or two hands;
  2. if the number is represented on two hands, the larger number is given first

    The rule number 2 I can not understand for example if it says 3, I have 3, 2+1, 1+2 (this not because its repeated), if it says 6 we have 6, 5+1, 4+2, 3+3, 2+4 + 1+5 but the correct output is 3, can someone guide me in this problem?? for 7 is 2, and 8 is 2, 9 is 1, and 10 is 1.

this is my code:

import java.util.Scanner;

class j1 {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int tot = 5;
        int n = sc.nextInt();
        int sum = 0;
        int count = 1;

        for (int i = 1; i <= tot; i++) {

            for (int j = 1; j <= tot; j++) {
                sum = i + j;
                if (sum == n) {

                    System.out.println(i);
                    System.out.println(j);
                    count++;
                }
              }


        }

        System.out.println(count);
        sc.close();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:40:50+00:00Added an answer on June 11, 2026 at 12:40 pm

    Its simple – if you are going to give the number using both the hands (2 hands) then you will first need to give the larger number which comprises the overall number –

    eg for 7 (4+3 OR 5+2) when represented using 2 hands – give 4 first !

    other option for 7 (3+4, 2+5) are invalid since it will make us to list the smaller number first which violates the rule #2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this exercise, is not a homework , I just trying to solve:
I've been trying to solve this issue for a long time, and nothing seems
I have been trying to solve this problem for a while, could not find
I'm trying a solve an exercise from Exploring Python book. But, I guess I
Been trying to solve this error for ages now, hoping that someone here can
I've been trying to solve this but no luck. This is my code. $replace1
I have been trying to solve this Concurrent Programming exam exercise (in C#): Knowing
I was trying to solve this issue recently, but i don't really know how.
I'm trying to solve the last exercise of this JavaScript Closure Tutorial which takes
I've been trying to solve this problem for over an hour now, and can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.