Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Delete the least number of integers from a given set of integers so that the product of the remaining integers in the set is a perfect square.

Delete the least number of integers from a given set of integers so that the product of the remaining integers in the set is a perfect square.

Scheduled Pinned Locked Moved C / C++ / MFC
css
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 12032960
    wrote on last edited by
    #1

    Delete the least number of integers from a given set of integers so that the product of the remaining integers in the set is a perfect square. In case there is more than one solution then find the solution that gives the largest perfect square. Assume that each integer contains five or less number of digits. The total number of integers in the given set is twenty or less. Input First line will be number of test cases The input may contain multiple test cases. For each test case there is a single input line. The line contains the given set of integers. Output For each test case there is only one output line. The line simply prints the integers to be deleted in ascending order. There are two special cases; print output for these cases as indicated below. Case 1: No integer is to be deleted: Print 0 as output. Case 2: All integers are to be deleted: Print all integers in ascending order. Sample Input 4 2 3 12 18 24 12 10 15 18 4 12 10 15 10 12 15 Sample Output 4 Case#1 = 24 Case#2 = 0 Case#3 = 10 12 15 Case#4 = 10 12 15

    L CPalliniC P 3 Replies Last reply
    0
    • U User 12032960

      Delete the least number of integers from a given set of integers so that the product of the remaining integers in the set is a perfect square. In case there is more than one solution then find the solution that gives the largest perfect square. Assume that each integer contains five or less number of digits. The total number of integers in the given set is twenty or less. Input First line will be number of test cases The input may contain multiple test cases. For each test case there is a single input line. The line contains the given set of integers. Output For each test case there is only one output line. The line simply prints the integers to be deleted in ascending order. There are two special cases; print output for these cases as indicated below. Case 1: No integer is to be deleted: Print 0 as output. Case 2: All integers are to be deleted: Print all integers in ascending order. Sample Input 4 2 3 12 18 24 12 10 15 18 4 12 10 15 10 12 15 Sample Output 4 Case#1 = 24 Case#2 = 0 Case#3 = 10 12 15 Case#4 = 10 12 15

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Sorry but we do not do your homework for you. Make an effort to do your own work and people will help you with specific problems.

      1 Reply Last reply
      0
      • U User 12032960

        Delete the least number of integers from a given set of integers so that the product of the remaining integers in the set is a perfect square. In case there is more than one solution then find the solution that gives the largest perfect square. Assume that each integer contains five or less number of digits. The total number of integers in the given set is twenty or less. Input First line will be number of test cases The input may contain multiple test cases. For each test case there is a single input line. The line contains the given set of integers. Output For each test case there is only one output line. The line simply prints the integers to be deleted in ascending order. There are two special cases; print output for these cases as indicated below. Case 1: No integer is to be deleted: Print 0 as output. Case 2: All integers are to be deleted: Print all integers in ascending order. Sample Input 4 2 3 12 18 24 12 10 15 18 4 12 10 15 10 12 15 Sample Output 4 Case#1 = 24 Case#2 = 0 Case#3 = 10 12 15 Case#4 = 10 12 15

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        What is your doubt about? How would you do it with pencil and paper?

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        • U User 12032960

          Delete the least number of integers from a given set of integers so that the product of the remaining integers in the set is a perfect square. In case there is more than one solution then find the solution that gives the largest perfect square. Assume that each integer contains five or less number of digits. The total number of integers in the given set is twenty or less. Input First line will be number of test cases The input may contain multiple test cases. For each test case there is a single input line. The line contains the given set of integers. Output For each test case there is only one output line. The line simply prints the integers to be deleted in ascending order. There are two special cases; print output for these cases as indicated below. Case 1: No integer is to be deleted: Print 0 as output. Case 2: All integers are to be deleted: Print all integers in ascending order. Sample Input 4 2 3 12 18 24 12 10 15 18 4 12 10 15 10 12 15 Sample Output 4 Case#1 = 24 Case#2 = 0 Case#3 = 10 12 15 Case#4 = 10 12 15

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #4

          This reeks like homework, have you asked your instructor for help?

          "I've seen more information on a frickin' sticky note!" - Dave Kreskowiak

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups