코드포스(CodeForce)

Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) - A. Arpa and a research in Mexican wave

cepiloth 2018. 8. 17. 17:30
반응형


1. 문제


2. 알고리즘

키워드 - 구현


3. 코드



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <cstdio>
#include <cmath>
#include <queue>
#include <cstring>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
 
int main()
{
    int n, k, t;
    cin >> n >> k >> t;
 
    int sol = 0;
    if (k >= t) {
        sol = t;
    }
    else if(n >= t) {
        sol = k;
    }
    else if(n <t ) {
        sol = k - (t - n);
    }
 
    cout << sol << endl;
    return 0;
}
cs


반응형