304 North Cardinal St.
Dorchester Center, MA 02124

# Akash and Missing Class CodeChef Solution

## Problem – Akash and Missing Class CodeChef Solution

Akash loves going to school, but not on weekends.

A week consists of 7 days (Monday to Sunday). Akash takes a leave every Saturday.

If a month consists of N days and the first-day of the month is Monday, find the number of days Akash would take a leave in the whole month.

### Input Format

• First line will contain T, the number of test cases. Then the test cases follow.
• Each test case contains a single line of input, one integer N – the number of days in the month.

### Output Format

For each test case, output in a single line, the number of days Akash would take a leave in the whole month.

### Constraints

• 1≤T≤100
• 1≤N≤10^9

• Subtask 1 (30 points) : 1≤N≤100
• Subtask 2 (70 points) : Original Constraints

### Sample 1:

``````Input:
4
5
6
8
22
Output:
0
1
1
3``````

### Explanation:

Test case 1: The month consists of 5 days (Monday, Tuesday, Wednesday, Thursday, and Friday). Since there are no Saturdays, Akash would go to school every day. Thus, he takes a leave for 0 days.

Test case 2: The month consists of 6 days (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday). Akash takes a leave only on Saturday. Thus, he takes a leave for 1 day.

Test case 3: The month consists of 8 days (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday, Monday). Akash takes a leave only on Saturday. Thus, he takes a leave for 1 day.

## Akash and Missing Class CodeChef Solution in C++14

``````#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
//  vector<int> v;

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main() {

ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

int t;
cin>>t;
while(t--)
{
int count=0;
int x;
cin>>x;
if(x>5)
{
count+=1;
x-=6;
}
count+=x/7;
cout<<count<<endl;
}

return 0;
}
``````

## Akash and Missing Class CodeChef Solution in Pyth 3

``````# cook your dish here
for _ in range(int(input())):
n = int(input());
z = (n+1)//7;
if n<=5:
print(0);
elif n==6:
print(1);
else:
print(z)``````

## Akash and Missing Class CodeChef Solution in Java

``````/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();

while(T >0){
int N = sc.nextInt();

if(N < 5)
System.out.println(0);

else if(N%7 == 0)
System.out.println(N/7);

else if(N%7 != 0){
if(N%7 < 6)
System.out.println(N/7);

else if(N%7 == 6)
System.out.println((N/7) + 1);
}

T--;
}
}
}
``````
##### Akash and Missing Class CodeChef Solution Review:

In our experience, we suggest you solve this Akash and Missing Class 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 Akash and Missing Class CodeChef Solution

Find on CodeChef

##### Conclusion:

I hope this Akash and Missing Class 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