-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36392cc
commit 6a8d74a
Showing
6 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
CP Contests/CodeChef/Starters 26/6. Control the Pollution/code.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# CodeChef Self-Learning |