15052022-11-21 14:33:26teodorbatkaiMicimackó (40 pont)cpp11Accepted 40/403ms3992 KiB
#include <iostream>

using namespace std;

int main(){
    int nt, mt, om, nm;
    cin >> nt >> mt >> om >> nm;
    int x = om;

    for(int i = 0; i < mt; i++){
        if(x != 0){
            x--;
        }  
        if(i == nt-1){
            x += nm;
        }     
    }
    cout << x << endl;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1908 KiB
2Accepted0/02ms2160 KiB
3Accepted2/22ms2364 KiB
4Accepted2/22ms2568 KiB
5Accepted2/22ms2720 KiB
6Accepted2/22ms2788 KiB
7Accepted2/22ms2916 KiB
8Accepted2/22ms3168 KiB
9Accepted2/22ms3368 KiB
10Accepted2/22ms3320 KiB
11Accepted2/22ms3396 KiB
12Accepted2/22ms3524 KiB
13Accepted2/22ms3640 KiB
14Accepted2/22ms3904 KiB
15Accepted2/22ms3840 KiB
16Accepted2/22ms3876 KiB
17Accepted2/22ms3984 KiB
18Accepted2/22ms3992 KiB
19Accepted2/22ms3956 KiB
20Accepted2/22ms3948 KiB
21Accepted2/22ms3836 KiB
22Accepted2/22ms3952 KiB