William comprehends that with all his activities he draws in increasingly more consideration from the trade's security group, so the number of his activities should not surpass 5000 and after each activity no factor can have a flat out esteem more noteworthy than 1018. William can perform activities of two kinds for two picked factors

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Correct answer will be upvoted else downvoted.

 

 

William comprehends that with all his activities he draws in increasingly more consideration from the trade's security group, so the number of his activities should not surpass 5000 and after each activity no factor can have a flat out esteem more noteworthy than 1018. William can perform activities of two kinds for two picked factors with files I and j, where i<j: 

 

Perform task ai=ai+aj 

 

Perform task aj=aj−ai 

 

William needs you to foster a system that will get every one of the interior factors to the ideal qualities. 

 

Input 

 

Each test contains numerous experiments. The main line contains the number of experiments t (1≤t≤20). Portrayal of the experiments follows. 

 

The main line of each experiment contains a solitary even integer n (2≤n≤103), which is the number of interior factors. 

 

The second line of each experiment contains n integers a1,a2,… ,an (1≤ai≤109), which are beginning upsides of inside factors. 

 

Output 

 

For each experiment print the appropriate response in the accompanying configuration: 

 

The main line of output should contain the complete number of activities k, which the system will perform. Note that you don't need to limit k. The imbalance k≤5000 should be fulfilled. 

 

Every one of the following k lines should contain activities arranged as "type I j", where "type" is equivalent to "1" if the procedure needs to play out a task of the main sort and "2" if the technique needs to play out a task of the subsequent kind. Note that i<j should hold.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education