# Kaalu and love, (https://www.codechef.com/BEST2021/problems/WEEKFIND)

Practice

Author: Anurag dubey
Tester: Anurag dubey
Editorialist: Anurag dubey

# DIFFICULTY:

CAKEWALK, SIMPLE, EASY.BRUTEFORCE,INTERMEDIET

Math,

# PROBLEM:

In given question we have just given a day and integer n we have to find out after n day what day will .

# QUICK EXPLANATION:

First check the day. then as we know that there is 7 days in a week so we will mod the given number with 7 and what ever output will came we will increase the day according to it .

# EXPLANATION:

First check the day. then as we know that there is 7 days in a week so we will mod the given number with 7 and what ever output will came we will increase the day according to it .
for example if given day is monday and given integer n is 8 then first we will first mod it with 7 and the output will came 1 then we know that 1 day after monday is tuesday so the output is tuesday .

# SOLUTIONS:

Setter's Solution
1. #include<bits/stdc++.h>

2. using namespace std;

• int main(){
1. int t;

2. cin>>t;

3. while(t–){

• string day;
1. cin>>day;

2. int n;

3. cin>>n;

4. int k=n%7;

5. if(day==“monday”){

6. if(k==1){

7. cout<<“tuesday”;

8. }

9. else if(k==2){

10. cout<<“wednesday”;

11. }

12. else if(k==3){

13. cout<<“thursday”;

14. }

15. else if(k==4){

16. cout<<“friday”;

17. }

18. else if(k==5){

19. cout<<“saturday”;

20. }

21. else if(k==6){

22. cout<<“sunday”;

23. }

24. else {

25. cout<<“monday”;

26. }

27. }

• else if(day==“tuesday”){
1. if(k==1){

2. cout<<“wednesday”;

3. }

4. else if(k==2){

5. cout<<“thursday”;

6. }

7. else if(k==3){

8. cout<<“friday”;

9. }

10. else if(k==4){

11. cout<<“saturday”;

12. }

13. else if(k==5){

14. cout<<“sunday”;

15. }

16. else if(k==6){

17. cout<<“monday”;

18. }

19. else {

20. cout<<“tuesday”;

21. }

• }

• else if(day==“wednesday”){

1. if(k==1){

2. cout<<“thursday”;

3. }

4. else if(k==2){

5. cout<<“friday”;

6. }

7. else if(k==3){

8. cout<<“saturday”;

9. }

10. else if(k==4){

11. cout<<“sunday”;

12. }

13. else if(k==5){

14. cout<<“monday”;

15. }

16. else if(k==6){

17. cout<<“tuesday”;

18. }

19. else {

20. cout<<“wednesday”;

21. }

• }

• else if(day==“thursday”){

1. if(k==1){

2. cout<<“friday”;

3. }

4. else if(k==2){

5. cout<<“saturday”;

6. }

7. else if(k==3){

8. cout<<“sunday”;

9. }

10. else if(k==4){

11. cout<<“monday”;

12. }

13. else if(k==5){

14. cout<<“tuesday”;

15. }

16. else if(k==6){

17. cout<<“wednesday”;

18. }

19. else {

20. cout<<“thursday”;

21. }

• }

• else if(day==“friday”){

1. if(k==1){

2. cout<<“saturday”;

3. }

4. else if(k==2){

5. cout<<“sunday”;

6. }

7. else if(k==3){

8. cout<<“monday”;

9. }

10. else if(k==4){

11. cout<<“tuesday”;

12. }

13. else if(k==5){

14. cout<<“wednesday”;

15. }

16. else if(k==6){

17. cout<<“thursday”;

18. }

19. else {

20. cout<<“friday”;

21. }

• }

• else if(day==“saturday”){

1. if(k==1){

2. cout<<“sunday”;

3. }

4. else if(k==2){

5. cout<<“monday”;

6. }

7. else if(k==3){

8. cout<<“tuesday”;

9. }

10. else if(k==4){

11. cout<<“wednesday”;

12. }

13. else if(k==5){

14. cout<<“thursaday”;

15. }

16. else if(k==6){

17. cout<<“friday”;

18. }

19. else {

20. cout<<“saturday”;

21. }

• }

• else {if(k==1){

1. cout<<“monday”;

2. }

3. else if(k==2){

4. cout<<“tuesday”;

5. }

6. else if(k==3){

7. cout<<“wednesday”;

8. }

9. else if(k==4){

10. cout<<“thursday”;

11. }

12. else if(k==5){

13. cout<<“friday”;

14. }

15. else if(k==6){

16. cout<<“saturday”;

17. }

18. else {

19. cout<<“sunday”;

20. }

• }
1. cout<<endl;

2. }

• return 0;
1. }
Tester's Solution
1. #include<bits/stdc++.h>

2. using namespace std;

• int main(){
1. int t;

2. cin>>t;

3. while(t–){

• string day;
1. cin>>day;

2. int n;

3. cin>>n;

4. int k=n%7;

5. if(day==“monday”){

6. if(k==1){

7. cout<<“tuesday”;

8. }

9. else if(k==2){

10. cout<<“wednesday”;

11. }

12. else if(k==3){

13. cout<<“thursday”;

14. }

15. else if(k==4){

16. cout<<“friday”;

17. }

18. else if(k==5){

19. cout<<“saturday”;

20. }

21. else if(k==6){

22. cout<<“sunday”;

23. }

24. else {

25. cout<<“monday”;

26. }

27. }

• else if(day==“tuesday”){
1. if(k==1){

2. cout<<“wednesday”;

3. }

4. else if(k==2){

5. cout<<“thursday”;

6. }

7. else if(k==3){

8. cout<<“friday”;

9. }

10. else if(k==4){

11. cout<<“saturday”;

12. }

13. else if(k==5){

14. cout<<“sunday”;

15. }

16. else if(k==6){

17. cout<<“monday”;

18. }

19. else {

20. cout<<“tuesday”;

21. }

• }

• else if(day==“wednesday”){

1. if(k==1){

2. cout<<“thursday”;

3. }

4. else if(k==2){

5. cout<<“friday”;

6. }

7. else if(k==3){

8. cout<<“saturday”;

9. }

10. else if(k==4){

11. cout<<“sunday”;

12. }

13. else if(k==5){

14. cout<<“monday”;

15. }

16. else if(k==6){

17. cout<<“tuesday”;

18. }

19. else {

20. cout<<“wednesday”;

21. }

• }

• else if(day==“thursday”){

1. if(k==1){

2. cout<<“friday”;

3. }

4. else if(k==2){

5. cout<<“saturday”;

6. }

7. else if(k==3){

8. cout<<“sunday”;

9. }

10. else if(k==4){

11. cout<<“monday”;

12. }

13. else if(k==5){

14. cout<<“tuesday”;

15. }

16. else if(k==6){

17. cout<<“wednesday”;

18. }

19. else {

20. cout<<“thursday”;

21. }

• }

• else if(day==“friday”){

1. if(k==1){

2. cout<<“saturday”;

3. }

4. else if(k==2){

5. cout<<“sunday”;

6. }

7. else if(k==3){

8. cout<<“monday”;

9. }

10. else if(k==4){

11. cout<<“tuesday”;

12. }

13. else if(k==5){

14. cout<<“wednesday”;

15. }

16. else if(k==6){

17. cout<<“thursday”;

18. }

19. else {

20. cout<<“friday”;

21. }

• }

• else if(day==“saturday”){

1. if(k==1){

2. cout<<“sunday”;

3. }

4. else if(k==2){

5. cout<<“monday”;

6. }

7. else if(k==3){

8. cout<<“tuesday”;

9. }

10. else if(k==4){

11. cout<<“wednesday”;

12. }

13. else if(k==5){

14. cout<<“thursaday”;

15. }

16. else if(k==6){

17. cout<<“friday”;

18. }

19. else {

20. cout<<“saturday”;

21. }

• }

• else {if(k==1){

1. cout<<“monday”;

2. }

3. else if(k==2){

4. cout<<“tuesday”;

5. }

6. else if(k==3){

7. cout<<“wednesday”;

8. }

9. else if(k==4){

10. cout<<“thursday”;

11. }

12. else if(k==5){

13. cout<<“friday”;

14. }

15. else if(k==6){

16. cout<<“saturday”;

17. }

18. else {

19. cout<<“sunday”;

20. }

• }
1. cout<<endl;

2. }

• return 0;
1. }
Editorialist's Solution
1. #include<bits/stdc++.h>

2. using namespace std;

• int main(){
1. int t;

2. cin>>t;

3. while(t–){

• string day;
1. cin>>day;

2. int n;

3. cin>>n;

4. int k=n%7;

5. if(day==“monday”){

6. if(k==1){

7. cout<<“tuesday”;

8. }

9. else if(k==2){

10. cout<<“wednesday”;

11. }

12. else if(k==3){

13. cout<<“thursday”;

14. }

15. else if(k==4){

16. cout<<“friday”;

17. }

18. else if(k==5){

19. cout<<“saturday”;

20. }

21. else if(k==6){

22. cout<<“sunday”;

23. }

24. else {

25. cout<<“monday”;

26. }

27. }

• else if(day==“tuesday”){
1. if(k==1){

2. cout<<“wednesday”;

3. }

4. else if(k==2){

5. cout<<“thursday”;

6. }

7. else if(k==3){

8. cout<<“friday”;

9. }

10. else if(k==4){

11. cout<<“saturday”;

12. }

13. else if(k==5){

14. cout<<“sunday”;

15. }

16. else if(k==6){

17. cout<<“monday”;

18. }

19. else {

20. cout<<“tuesday”;

21. }

• }

• else if(day==“wednesday”){

1. if(k==1){

2. cout<<“thursday”;

3. }

4. else if(k==2){

5. cout<<“friday”;

6. }

7. else if(k==3){

8. cout<<“saturday”;

9. }

10. else if(k==4){

11. cout<<“sunday”;

12. }

13. else if(k==5){

14. cout<<“monday”;

15. }

16. else if(k==6){

17. cout<<“tuesday”;

18. }

19. else {

20. cout<<“wednesday”;

21. }

• }

• else if(day==“thursday”){

1. if(k==1){

2. cout<<“friday”;

3. }

4. else if(k==2){

5. cout<<“saturday”;

6. }

7. else if(k==3){

8. cout<<“sunday”;

9. }

10. else if(k==4){

11. cout<<“monday”;

12. }

13. else if(k==5){

14. cout<<“tuesday”;

15. }

16. else if(k==6){

17. cout<<“wednesday”;

18. }

19. else {

20. cout<<“thursday”;

21. }

• }

• else if(day==“friday”){

1. if(k==1){

2. cout<<“saturday”;

3. }

4. else if(k==2){

5. cout<<“sunday”;

6. }

7. else if(k==3){

8. cout<<“monday”;

9. }

10. else if(k==4){

11. cout<<“tuesday”;

12. }

13. else if(k==5){

14. cout<<“wednesday”;

15. }

16. else if(k==6){

17. cout<<“thursday”;

18. }

19. else {

20. cout<<“friday”;

21. }

• }

• else if(day==“saturday”){

1. if(k==1){

2. cout<<“sunday”;

3. }

4. else if(k==2){

5. cout<<“monday”;

6. }

7. else if(k==3){

8. cout<<“tuesday”;

9. }

10. else if(k==4){

11. cout<<“wednesday”;

12. }

13. else if(k==5){

14. cout<<“thursaday”;

15. }

16. else if(k==6){

17. cout<<“friday”;

18. }

19. else {

20. cout<<“saturday”;

21. }

• }

• else {if(k==1){

1. cout<<“monday”;

2. }

3. else if(k==2){

4. cout<<“tuesday”;

5. }

6. else if(k==3){

7. cout<<“wednesday”;

8. }

9. else if(k==4){

10. cout<<“thursday”;

11. }

12. else if(k==5){

13. cout<<“friday”;

14. }

15. else if(k==6){

16. cout<<“saturday”;

17. }

18. else {

19. cout<<“sunday”;

20. }

• }
1. cout<<endl;

2. }

• return 0;
1. }