Skip to content

Commit

Permalink
Added new question in Starters 26
Browse files Browse the repository at this point in the history
  • Loading branch information
KaranSiddhu committed Feb 20, 2022
1 parent 36392cc commit 6a8d74a
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CP Contests/CodeChef/Starters 26/1. Car or Bus/code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ using namespace std;
#define ll long long
#define db double
#define ld long double
#define el "\n"

void solution(){
int x,y;
cin >> x >> y;

cout << ((x > y ? "CAR" : (x == y ? "SAME" : "BIKE") )) << "\n";
cout << ((x > y ? "CAR" : (x == y ? "SAME" : "BIKE") )) << el;
}

int main(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ using namespace std;
#define ll long long
#define db double
#define ld long double
#define el "\n"

void solution(){
int x, y;
cin >> x >> y;

cout << (x/y) << "\n";
cout << (x/y) << el;
}

int main(){
Expand Down
3 changes: 2 additions & 1 deletion CP Contests/CodeChef/Starters 26/4. Hostel Room/code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ using namespace std;
#define ll long long
#define db double
#define ld long double
#define el "\n"

void solution(){
int n, x;
Expand All @@ -20,7 +21,7 @@ void solution(){
max = x;
}

cout<< max << "\n";
cout<< max << el;
}

int main(){
Expand Down
3 changes: 2 additions & 1 deletion CP Contests/CodeChef/Starters 26/5. Careless Chef/code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ using namespace std;
#define ll long long
#define db double
#define ld long double
#define el "\n"

void solution(){
int n;
Expand All @@ -14,7 +15,7 @@ void solution(){
sum += b;
}

cout << ((sum % 2 == 0) ? "YES" : "NO" ) << "\n";
cout << ((sum % 2 == 0) ? "YES" : "NO" ) << el;

}

Expand Down
33 changes: 33 additions & 0 deletions CP Contests/CodeChef/Starters 26/6. Control the Pollution/code.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ld long double
#define el "\n"

void solution(){
int n,x,y;
cin >> n >> x >> y;

int ans = INT32_MAX;

for(int bus = 0; bus <= ceil(n / 100.0); bus++){
int cars = max((double)0, ceil((n-bus*100) / 4.0));
int smoke = bus * x + cars * y;
ans = min(ans, smoke);
}

cout << ans << el;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int t;
cin >> t;
while(t--)
solution();

return 0;
}
1 change: 1 addition & 0 deletions CodeChef Self-Learning/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CodeChef Self-Learning

0 comments on commit 6a8d74a

Please sign in to comment.