0% found this document useful (0 votes)
8 views

Case Study For Java

Uploaded by

34Sayandeep Paul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Case Study For Java

Uploaded by

34Sayandeep Paul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

JAVA CASES

Problem
You are given the sequence of Nucleotides of one strand of DNA through a string SS of
length NN. SS contains the character A, T, C, A, T, C, and GG only.

knows that:

• AA is complementary to TT.
• TT is complementary to AA.
• CC is complementary to GG.
• GG is complementary to CC.
Using the string SS, determine the sequence of the complementary strand of the DNA.

Input Format
• First line will contain TT, number of test cases. Then the test cases follow.
• First line of each test case contains an integer NN - denoting the length of string SS.
• Second line contains NN characters denoting the string SS.

Output Format
For each test case, output the string containing NN characters - sequence of nucleotides of
the complementary strand.

Constraints
• 1≤T≤100
• 1≤N≤100
• S contains A, T, C, and G only

Sample 1:
Input
4
4
ATCG
4
GTCC
5
AAAAA
3
TAC

Output

TAGC
CAGG
TTTTT
ATG

1. Problem
There are 1010 problems in a contest. You know that the score of each problem is
either 11 or 100100 points.

came to know the total score of a participant and he is wondering how many problems
were actually solved by that participant.

Given the total score PP of the participant, determine the number of problems solved by
the participant. Print -1−1 in case the score is invalid.

Input Format
• First line will contain TT, number of test cases. Then the test cases follow.
• Each test case contains of a single line containing a single integer PP - denoting the number
of points scored by the participant.

Output Format
For each testcase, output the number of problems solved by the participant or -1−1 if the
score is invalid.

Constraints
• 1≤T≤1000
• 0≤P≤1000
Sample 1:
Input
5
103
0
6
142
1000

Output

4
0
6
-1
10

You might also like