 # Week day (https://www.codechef.com/LCD321TS/problems/WEEKGAME)

Practice

Author: Aryan KD
Tester: Aryan KD
Editorialist: Aryan KD

# DIFFICULTY:

CAKEWALK, SIMPLE, EASY.

Math .

# PROBLEM:

If today is sunday what day will after N days later.

for example :

N=4

O/P= thursday

# EXPLANATION:

There is 7 days in a week and today is sunday we have given N number we have to find what day after N days if we mod a number with 7 then whatever reminder is remain then after N days that day will come.

lets take an example

n=4
if we mod 4 by 7 then there is 4 is remain
that is after sunday if we add 4 then after 4 days of sunday is there is thursday

# SOLUTIONS:

Setter's Solution

#include<bits/stdc++.h>
using namespace std;
void testcase()
{
int n;
cin>>n;
int k=n%7;
if(k==1){
cout<<“monday”;
}

if(k==2){
cout<<“tuesday”;
}

if(k==3){
cout<<“wednesday”;
}

if(k==4){
cout<<“thursday”;
}

if(k==5){
cout<<“friday”;
}

if(k==6){
cout<<“saturday”;
}

if(k==0){
cout<<“sunday”;
}
}
int main()
{
int t;
cin>>t;
while(t–)
{
testcase();
cout<<endl;
}
return 0;
}

Tester's Solution

#include<bits/stdc++.h>
using namespace std;
void testcase()
{
int n;
cin>>n;
int k=n%7;
if(k==1){
cout<<“monday”;
}

if(k==2){
cout<<“tuesday”;
}

if(k==3){
cout<<“wednesday”;
}

if(k==4){
cout<<“thursday”;
}

if(k==5){
cout<<“friday”;
}

if(k==6){
cout<<“saturday”;
}

if(k==0){
cout<<“sunday”;
}
}
int main()
{
int t;
cin>>t;
while(t–)
{
testcase();
cout<<endl;
}
return 0;
}

Editorialist's Solution

#include<bits/stdc++.h>
using namespace std;
void testcase()
{
int n;
cin>>n;
int k=n%7;
if(k==1){
cout<<“monday”;
}

if(k==2){
cout<<“tuesday”;
}

if(k==3){
cout<<“wednesday”;
}

if(k==4){
cout<<“thursday”;
}

if(k==5){
cout<<“friday”;
}

if(k==6){
cout<<“saturday”;
}

if(k==0){
cout<<“sunday”;
}
}
int main()
{
int t;
cin>>t;
while(t–)
{
testcase();
cout<<endl;
}
return 0;
}