That’s not a correct link to your code 
This gives the wrong answer for the testcase:
9
3 66
3 20
2 60
2 1
1 69
3 66
3 1
3 72
1 54
(the answer should be
2 388
)
why 388 aint should be 338, check the test case once please.
In round 1 player 1 scored: 3 and player 2 scored: 66
The cumulative scores are now - player 1: 3; player 2: 66
New best lead: player 2 has a lead of 63 over player 1
In round 2 player 1 scored: 3 and player 2 scored: 20
The cumulative scores are now - player 1: 6; player 2: 86
New best lead: player 2 has a lead of 80 over player 1
In round 3 player 1 scored: 2 and player 2 scored: 60
The cumulative scores are now - player 1: 8; player 2: 146
New best lead: player 2 has a lead of 138 over player 1
In round 4 player 1 scored: 2 and player 2 scored: 1
The cumulative scores are now - player 1: 10; player 2: 147
In round 5 player 1 scored: 1 and player 2 scored: 69
The cumulative scores are now - player 1: 11; player 2: 216
New best lead: player 2 has a lead of 205 over player 1
In round 6 player 1 scored: 3 and player 2 scored: 66
The cumulative scores are now - player 1: 14; player 2: 282
New best lead: player 2 has a lead of 268 over player 1
In round 7 player 1 scored: 3 and player 2 scored: 1
The cumulative scores are now - player 1: 17; player 2: 283
In round 8 player 1 scored: 3 and player 2 scored: 72
The cumulative scores are now - player 1: 20; player 2: 355
New best lead: player 2 has a lead of 335 over player 1
In round 9 player 1 scored: 1 and player 2 scored: 54
The cumulative scores are now - player 1: 21; player 2: 409
New best lead: player 2 has a lead of 388 over player 1
Final winner/ lead:
2 388
Can someone help me with this, please?
I get the same results as in the example but it still shows wrong answer :-
https://www.codechef.com/viewsolution/40385455
I got right answer but it could not consider
help plz
using namespace std;
float bank(int wid, float bal);
int main(void)
{
int wid;
float bal;
cin >> wid >> bal;
float x = bank(wid, bal);
printf("%.2f", x);
return 0;
}
float bank(int wid, float bal)
{
if (wid >= bal)
{
return bal;
}
else
{
if (wid % 5 == 0)
{
return (bal - wid - 0.5);
}
else if (wid % 5 != 0)
{
return bal;
}
}
}
//this code is running properly and is satisfying all the test cases still when I try to submit it shows the wrong answer. the question is ATM and the Problem Code: HS08TEST
You are ignoring one more case.
What happens when the test case is : 100 100 ?
Your code will print YES even though the answer is NO . I hope you get the point.
#include <stdio.h>
int main() {
// your code goes here
int i,T;
scanf("%d",&T);
for(i=0;i<T;i++)
{
int N,d,m,sum=0,n;
scanf("%d",&d);
N=d;
n=N+1;
while(n>0)
{
m=n%10;
sum=sum+m;
n=n/10;
}
printf("%d",sum);
}
return 0;
}
please tell me why i get wrong answer… Problem Code:[ICPC16C]
#include
using namespace std;
int withdraw;
double acc_amnt;
int main()
{
// your code goes here.
cin>>withdraw>>acc_amnt;
// If the Transaction SUCCESS.
if((withdraw%5 == 0) && (acc_amnt > (withdraw+0.50)))
{
acc_amnt = acc_amnt - (withdraw+0.500);
//cout<<acc_num;
printf("%.2f \n",acc_amnt);
}
// If the Transaction not SUCCESS.
if(withdraw%5 != 0 || acc_amnt < withdraw)
{
//cout<<acc_num;
printf("%.2f \n",acc_amnt);
}
return 0;
}
import java.util.Scanner;
class code_chef_1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double balance=120.0;
System.out.println(“Enter the amount to be withdrawn :”);
double withdrawal=sc.nextDouble();
if(((withdrawal+0.5)<=balance) && (withdrawal % 5 == 0))//successful transaction.
{
balance= balance-(withdrawal+0.5);
System.out.println(balance);
}
else if(((withdrawal+0.5)>balance) && (withdrawal % 5 == 0)) //insufficient funds.
System.out.println(balance);
else // incorrect withdrawal amount.
System.out.println(balance);
}
}
LINK : CodeChef: Practical coding for everyone
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
cin.ignore();
while (n–)
{int c=0;
string str, strj;
getline(cin, str);
getline(cin, strj);
{for(int i=0; i<str.length(); i++)
{ for(int j=0; j<strj.length(); j++)
if(str[i]==strj[j])
{ c++;
strj[j]='1';
break; }}
cout<<c<<endl;
}
}
}
I am getting correct answers in my IDE and even in codechef one but when i try to submit it, it says wrong answer. Can anyone tell me the mistake which i commited?
@jha_suryash99
try this input :
1
a
aaa
output should be:3
Question was “You have to find out how many characters of S are in J as well.”…I think u are doing it other way around.
#include
#include<math.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,d,h;
cin>>n>>d>>h;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int tot=0;
for(int i=0;i<n;i++)
{
if(a[i]>0)
{
tot+=a[i];
}
else
{
tot=max(tot-d,0);
}
}
if(tot>h)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
this is my code for ‘REDALERT’ from July lunch time i am getting W A
please help me o resolve this issue.
Bcoz we are noob bro
t = int(input())
for i in range(t):
A,B = input().split()
if(A>B):
print(">")
elif(A<B):
print("<")
else:
print("=")
It is showing wrong answer. Why is it so?
#include
using namespace std;
int main()
{
int n,r=0;
cin>>n;
while(n!=0)
{
r=(r*10)+(n%10);
n/=10;
}
cout<<r<<endl;
return 0;
}
i hope this is helpful
- Crazy Subsequences Codechef Solution
- Tree of Trees Codechef Solution
- Dominant Element Codechef Solution
- Make A and B equal Codechef Solution
- Sale Season Codechef Solution
- TV Discount Codechef Solution
- Maximum Submissions Codechef Solution
- Final Population Codechef Solution
- CodeChef DSA Learning Series Solutions
- Multiple of 3 CodeChef Solution