LOSTWKND - Editorial

The if condition should be if(sum>120) because he will have 120 hours in weekdays(24*5).
And you have to print “Yes” instead of “YES” and “No” instead of “NO”.

python solution
t = int(input())

for i in range(t):
l = []
arr = list(map(int,input().split()))
p = arr.pop()
arr = [i*p for i in arr]
new = sum(arr)
if new > 120:
print(“Yes”)
else:
print(“No”)

for _ in range(int(input())):
a = list(map(int, input().split()))
p = a[5]
if((a[0] + a[1] + a[2] + a[3] + a[4])*p > 120):
print(“Yes”)
else:
print(“No”)

^^ PYTH 3.6
Problem link: LOSTWKND Problem - CodeChef
Submit link: CodeChef: Practical coding for everyone
Solution link: CodeChef: Practical coding for everyone
Discussion link: LOSTWKND - Editorial - #39 by ritz1804

:+1:

1 Like

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