Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
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.
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.
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 a single integer in a single line – the number of weeks in which Chef solved at least 10 problems.
Input: 12 15 8 10
Output: 3
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.
Input: 2 3 1 10
Output: 1
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.
Input: 12 100 99 11
Output: 4
Chef solved at least 10 problems in all the four weeks. Hence, the number of weeks in which Chef met his target is 4.
Input: 1 1 1 1
Output: 0
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.
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);
}
}
#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;
}
arr=list(map(int,input().split()))
a=0
for i in range(4):
if arr[i]>=10:
a+=1
print(a)
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
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 >>