Input
The first line of the input consists of two spa
separated integers days and products,
representing the days (M) and the products
the tales record (N), respectively.
The next M lines consist of N space-separate
integers representing the sales revenue (can
be positive or negative) received from each
product each day.
Output
Print M space-separated integers
representing the maximum revenue received
each day
Example
Input
34
100 198 333 323..in python programming
Answers
Answer:
An article containing recent Directi programming round questions in my campus placements and also those in my friends’ colleges.
1) You are given a string S. Each character of S is either ‘a’, or ‘b’. You wish to reverse exactly one sub-string of S such that the new string is lexicographically smaller than all the other strings that you can get by reversing exactly one sub-string.
For example, given ‘abab’, you may choose to reverse the substring ‘ab’ that starts from index 2 (0-based). This gives you the string ‘abba’. But, if you choose the reverse the substring ‘ba’ starting from index 1, you will get ‘aabb’. There is no way of getting a smaller string, hence reversing the substring in the range [1, 2] is optimal.
Input
First line contains a number T, the number of test cases.
Each test case contains a single string S. The characters of the string will be from the set { a, b }.
Output
For each test case, print two numbers separated by comma; for example “x,y” (without the quotes and without any additional whitespace). “x,y” describe the starting index (0-based) and ending index respectively of the substring that must be reversed in order to achieve the smallest lexicographical string. If there are multiple possible answers, print the one with the smallest ‘x’. If there are still multiple answers possible, print the one with the smallest ‘y’.
Constraints
1 <= T <= 100
1 <= length of S <= 1000
Sample Input
5
abab
abba
bbaa
aaaa
babaabba
Sample Output
1,2
1,3
0,3
0,0
0,4
2) Given two strings I and F, where I is the initial state and F is the final state. Each state will contain ‘a’,’b’ and only one empty slot represented by ‘_’. Your task is to move from the initial state to the final state with the minimum number of operation.
Allowed operations are
1. You can swap empty character with any adjacent character. (For example ‘aba_ab’ can be converted into ‘ab_aab’ or ‘abaa_b’).
2. You can swap empty character with next to the adjacent character only if the adjacent character is different from next to the adjacent character. (For example ‘aba_ab’ can be converted into ‘a_abab’ or ‘ababa_’, but ‘ab_aab’ cannot be converted to ‘abaa_b’, because ‘a’ cannot jump over ‘a’).
Input
The first line contains single integer T – the number of test cases (less than 25). T-test cases follow.
Each test case contains two string I and F in two different lines, where I is the initial state and F is the final state. I and F may be equal. Their length will always be equal. Their length will be at least 2. Their length will never be more than 20.
please give me brainlist answer
PYTHON CODE
import java.util.*;
import java.io.*;
import java.lang.Math.*;
class Solution{
public static void main(String []argh){
Scanner in = new Scanner(System.in);
int t=in.nextInt();
for(int i=0;i<t;i++){
int a = in.nextInt();
int b = in.nextInt();
int n = in.nextInt();
int calc = a;
for(int j=0;j<n;j++)
{
calc+=(Math.pow(2,j)*b);
System.out.print(calc+" ");
}
System.out.println();
}
in.close();
}
}
#SPJ3