How to Solve Practice makes us perfect Problem Code: PRACTICEPERF C#
This is how to solve using C#
using System;
public class Test
{
public static void Main()
{
string[] s = Console.ReadLine().Split(' ');
int count = 0;
for(int i = 0; i < s.Length; i++)
{
if(int.Parse(s[i]) >= 10)
{
count++;
}
}
Console.WriteLine(count);
}
}
Click here to Solve this Problem at CodeChef site
Problem
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 problems every week for weeks.
Given the number of problems he actually solved in each week over weeks as and , output the number of weeks in which Chef met his target.
Input Format
There is a single line of input, with integers and . These are the number of problems solved by Chef in each of the weeks.
Output Format
Output a single integer in a single line - the number of weeks in which Chef solved at least problems.
Constraints
Sample 1:
12 15 8 10
3
Explanation:
Chef solved at least problems in the first, second and fourth weeks. He failed to solve at least problems in the third week. Hence, the number of weeks in which Chef met his target is .
Sample 2:
2 3 1 10
1
Explanation:
Chef solved at least problems in the fourth week. He failed to solve at least problems in all the other three weeks. Hence, the number of weeks in which Chef met his target is .
Sample 3:
12 100 99 11
4
Explanation:
Chef solved at least problems in all the four weeks. Hence, the number of weeks in which Chef met his target is .
Sample 4:
1 1 1 1
0
Explanation:
Chef was not able to solve at least problems in any of the four weeks. Hence, the number of weeks in which Chef met his target is .
I think I should join CodeChef for practice...
ReplyDeleteYes, thats good idea mate
Delete