다시 알고리즘도 시작해야할 때가 되었다. KSEF와 함께...
https://www.acmicpc.net/problem/25704
25704번: 출석 이벤트
쇼핑몰에서 30일간 출석 이벤트를 진행한다. 쇼핑몰의 사이트를 방문하면 1일 1회 출석 도장을 받을 수 있고, 출석 도장을 여러 개 모아서 할인 쿠폰으로 교환할 수 있다. 출석 도장의 개수에 따
www.acmicpc.net

풀이
조건문을 잘 작성해주면 된다. max, min stl의 자료형 비교에 주의하자
시간 복잡도 : O(1)
소요 시간 : 5분
아쉬운 점 : 피곤하다
전체적인 감상 : 너무 바쁘다
/* basic setup {{{ */ #include<bits/stdc++.h> #define ff first #define ss second #define pb push_back #define sz(x) ((int)x.size()) #define all(x) x.begin(),x.end() #define compress(x) sort(all(x)), x.erase(unique(all(x)), x.end()) #define fast_io ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef const int ci; const int MOD = 1e9+7; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; /*}}}*/ int main(){ fast_io; double n, a; cin>>n>>a; double mn = a; if(n >= 20) mn=min(mn,a*0.75); else if(n>=10) mn=min(mn,a*0.9); if(n >= 15) mn=min(mn,a-2000); else if(n>=5) mn=min(mn,a-500); cout<<max(0.0,mn); cout<<'\n'; }
'백준 문제 해설' 카테고리의 다른 글
백준 1731 추론 (0) | 2022.11.09 |
---|---|
백준 4179 불! (0) | 2022.11.08 |
백준 24751 Betting (0) | 2022.11.08 |
백준 15749 Snow Boots (0) | 2022.11.06 |
백준 18409 母音を数える (Counting Vowels) (0) | 2022.11.04 |
백준 4589 Gnome Sequencing (0) | 2022.11.03 |
백준 23235 The Fastest Sorting Algorithm In The World (0) | 2022.11.02 |
백준 17356 욱 제 (0) | 2022.11.01 |