Codechef Problems: Vacation Clothes (VACCLOTH)
Problem Statement:
Solution:
Given,
N - Days of Vacation
7 - days after which clothes can be worn again
to find, sets of clothes required for vacation
case 1 : N <= 7 (i.e., vacation is at most 7 days long)
output : N sets of clothes are required
case 2 : otherwise (i.e., vacation is at least 7 days long)
output: 7 sets of clothing are required
reason : because the set worn on 1st day is available to (1st + 7) = 8th day. so, with vacation more than 7 days long number of sets of clothes required are 7.
Code Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n <= 7) {
cout << n << endl;
} else {
cout << 7 << endl;
}
return 0;
}
Comments
Post a Comment