LOSTWKND - Editorial

There is difference in “YES” and “Yes” and same for NO and No

yes because output is case sensitive and codechef will give WA for YES and NO in this question as i have already mentioned above

class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int tcs = sc.nextInt();
while(tcs > 0) {
int sum = 0;
for(int i = 0; i<5; i++){
sum = sum + sc.nextInt();
}
int p = sc.nextInt();
if((sum * p) <= 120) {
System.out.println(“Yes”);
} else {
System.out.println(“No”);
}
tcs–;
}

}

}

Getting WA for this piece. Can someone point out?

Read the problem statement again, this time ready it carefully.

1 Like

Hi
A[0]=A1
A[1]=A2
A[2]=A3
A[3]=A4
A[4]=A5
sum=0
sum=sum+A[0]+A[1]+A[2]+A[3]+A[4]
mix=P*sum
if mix>125
print yes
else print no

I hope its clear and useful

it should be mix > 120, not 125. I’m guessing it’s a typo

https://www.codechef.com/viewsolution/33454761

Yes, You are right its 5 * 24 = 120
but
what is typo?

1 Like

Typo is slang for typing error

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t,p;
	cin>>t;
	while(t--){
		vector<int> a(5);
		for(auto &it: a) cin>>it;
		cin>>p;
	        for(int i=0;i<(int)a.size();i++){
			a[i]=a[i]*p;
		}
		int x=accumulate(a.begin(),a.end(),0);
		
		if(x>120)
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}
	return 0;
}

Why the above code shows Runtime Error(SIGCONT)?
Frustrating!
Please Help.
Its running just fine on my machine as well as geeksforgeeks IDE…I think something is wrong with CodeChef IDE !

#include <bits/stdc++.h>
using namespace std;

int main(){
int x,a[5],c,y;
cin>>x;
while(x!=0) {c=0;
for(int i=0;i<5;i++){
cin>>a[i];}
cin>>y;
for(int i=0;i<5;i++){
c=c+a[i]*y;}
if(c<=120)
{ cout<<“No\n”;}
else
{ cout<<“Yes\n”;}
x–;
}
return 0;
}
Please help me…I am getting runtime error SIGCONT.


c++

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t,s=0;
	cin>>t;
	while(t--)
	{
	    int a[5],p;
	    for(int i =0 ;i<5;i++)
	    {
	        cin>>a[i];
	        s+=a[i];
	    }
	    cin>>p;
	    if(s*p>120)
	    {
	        cout<<"Yes"<<"\n";
	    }
	    else
	    {
	        cout<<"No"<<"\n";
	    }
	}
	return 0;
}

What’s wrong here can’t figure out?
@galencolin @hackslash_123 @taran_1407

If you’re going to ping me, at least format your code

1 Like

Oh my bad I am new to all of this. Getting use to it.

Good, now you know how the sample has two testcases? Reverse their order and run your program on it.

1 Like

I have to reset “s”. I wasn’t doing that.

Thanks for helping out !

1 Like

I am new to Competitive Programming. Not getting proper guidance. If you could guide me regarding it.

It would be great help :slight_smile:

How so? I feel like I could form some public “guidance” group where I spam my “tutorial” blogs and force people to heart them :slight_smile:

Generally though, I would recommend not having guidance, at least to some extent. The more questions you ask, the less you figure out for yourself, and the less you’ll be able to remember or use the information in the future. Unfortunately most people on here don’t seem to realize that. I’ll give you an EXCLUSIVE CP TRAINING CLICKBAIT TIP though - this site got me started with CP and it’s awesome.

1 Like

Thanks !