# Minimum Attendance Requirement Codechef Solution|Problem Code: ATTENDU

Hello coders, today we are going to solve Minimum Attendance Requirement Codechef Solution.

### Problem

A semester in Chef’s University has 120 working days. The University’s requirement is that a student should be present for at least 75%of the working days in the semester. If not, the student is failed.

Chef has been taking a lot of holidays, and is now concerned whether he can pass the attendance requirement or not. NN working days have already passed, and you are given Nbits – B1, B2, …, BN. Bi = 0 denotes that Chef was absent on the ith day, and Bi = 11 denotes that Chef was present on that day.

Can Chef hope to pass the requirement by the end of the semester?

### Input:

• First line will contain T, the number of testcases. Then the testcases follow.
• Each testcase contains two lines of input.
• The first line of each testcase contains a single integer, N, the number of days till now.
• The second line of each testcase contains a string B of length N where Bi represents the status of the ithith day.

### Output:

For each testcase, output the answer in a single line – “YES” if Chef can pass the attendance requirement and “NO” if not.

### Constraints

• 1≤T≤101≤T≤10
• 1≤N≤1201≤N≤120
• 0≤Bi≤1

### Sample Input 1

``````3
50
00000000000000000000000000000000000000000000000000
50
01010101010101010101010101010101010101010101010101
2
01``````

```NO
YES
YES```

### Minimum Attendance Requirement CodeChef Solution in JAVA

```import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int tc = 0; tc < T; ++tc) {
sc.nextInt();
String B = sc.next();
System.out.println(solve(B) ? "YES" : "NO");
}
sc.close();
}
static boolean solve(String B) {
return B.chars().filter(ch -> ch == '0').count() <= 30;
}
}```

### Minimum Attendance Requirement CodeChef Solution in CPP

```#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,count=0;
cin>>n;
string s;
cin>>s;
for(int i=0;i<n;i++){
if(s[i]=='1')
count++;
}
int p=count+120-n;
float x=(p*100)/120;
if(x>=75)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}```

### Minimum Attendance Requirement CodeChef Solution in Python

```t=int(input())
for _ in range(t):
n=int(input())
s=input()
l=[]
l[:]=s
c=l.count("1")
c+=120-n
if (c/120)*100<75:
print("NO")
else:
print("YES")```

Disclaimer: The above Problem (Minimum Attendance Requirement) is generated by CodeChef but the solution is provided by Chase2learn. This tutorial is only for Educational and Learning purpose.

Sharing Is Caring