Submission #1364808

#TimeUsernameProblemLanguageResultExecution timeMemory
1364808mon_de2738RUN Sequence (KAISTRUN26SPRING_B)C++20
100 / 100
0 ms344 KiB
#include<iostream>
using namespace std;
using ll=long long;
ll R,U,N;
ll F[55];
 
int main(){
    F[1]=F[2]=1;
    for(int i=3; i<55; i++) F[i]=F[i-1]+F[i-2];
    int pos=lower_bound(F,F+55,1e9)-F;
    cin >> R >> U >> N;
    ll neg=0;
    if(N-1<pos) neg=max(0LL, U-F[N-2])*max(0LL, R-F[N-1]);
    cout << R*U-neg;
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...