Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef really likes to compete on Codechef, and he has gained an impressive rating of X, where X>0. There is also a parallel universe, where ratings on Codechef are negative instead. The only thing that remains unchanged in the parallel universe is Chef’s love for competing on Codechef. Chef’s rating on Codechef in the parallel universe is Y, where Y<0.
Due to some cosmic event, the parallel universe has been destroyed, resulting in Chef forgetting both X and Y. He only remembers the sum S=X+Y. He wonders what the maximum possible product of his ratings is, given that he knows the sum of his ratings.
Subtask #1 (100 points): Original constraints
Input:
2
0
1
Output:
-1
-2
Test case 1: We have X>0 and X+Y=0. This implies that Y=−X. The product of ratings is −X^2, and the maximum possible product is −1.
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner scan=new Scanner(System.in);
int t=scan.nextInt();
while (t-->0){
int a=scan.nextInt();
//int b=scan.nextInt();
System.out.println((a*-1)-1);
}
}
}
# cook your dish here
for i in range(int(input())):
s=int(input())
print(-(s+1))
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t,s;
cin>>t;
while(t--)
{
cin>>s;
cout<<-(s+1)<<endl;
}
return 0;
}
In our experience, we suggest you solve this The Rating Dilemma CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the The Rating Dilemma CodeChef Solution
I hope this The Rating Dilemma CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>