Practice makes us perfect CodeChef Solution

Problem – Practice makes us perfect CodeChef Solution

Most programmers will tell you that one of the ways to improve your performance in competitive programming is to practice a lot of problems.

Our Chef took the above advice very seriously and decided to set a target for himself.

  • Chef decides to solve at least 10 problems every week for 4 weeks.

Given the number of problems he actually solved in each week over 4 weeks as P1​,P2​,P3​, and P4​, output the number of weeks in which Chef met his target.

Input Format

There is a single line of input, with 4 integers P1​,P2​,P3​, and P4​. These are the number of problems solved by Chef in each of the 4 weeks.

Output Format

Output a single integer in a single line – the number of weeks in which Chef solved at least 10 problems.

Constraints

  • 1≤P1​,P2​,P3​,P4​≤100

Sample 1:

Input: 12 15 8 10
Output: 3

Explanation:

Chef solved at least 10 problems in the first, second and fourth weeks. He failed to solve at least 10 problems in the third week. Hence, the number of weeks in which Chef met his target is 3.

Sample 2:

Input: 2 3 1 10
Output: 1

Explanation:

Chef solved at least 10 problems in the fourth week. He failed to solve at least 10 problems in all the other three weeks. Hence, the number of weeks in which Chef met his target is 1.

Sample 3:

Input: 12 100 99 11
Output: 4

Explanation:

Chef solved at least 10 problems in all the four weeks. Hence, the number of weeks in which Chef met his target is 4.

Sample 4:

Input: 1 1 1 1
Output: 0

Explanation:

Chef was not able to solve at least 10 problems in any of the four weeks. Hence, the number of weeks in which Chef met his target is 0.

Practice makes us perfect CodeChef Solution in Java

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		
		int count=0;
		
		for(int i=0;i<4;i++)
		{
		    int a=sc.nextInt();
		    if(a>=10)
		    count+=1;
		}
		System.out.print(count);
		
	}
}

Practice makes us perfect CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
	int p1,p2,p3,p4,ans=0;
	cin>>p1>>p2>>p3>>p4;
	if(p1>=10){
	    ans++;
	}
	if(p2>=10){
	ans++;
	}
	if(p3>=10){
	    ans++;
	}
	if(p4>=10){
	    ans++;
	}
	cout<<ans<<"\n";
	
    return 0;
}        

Practice makes us perfect CodeChef Solution in Pyth 3

arr=list(map(int,input().split()))
a=0
for i in range(4):
    if arr[i]>=10:
        a+=1
print(a)
Practice makes us perfect CodeChef Solution Review:

In our experience, we suggest you solve this Practice makes us perfect 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 Practice makes us perfect CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Practice makes us perfect 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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *