Cod sursa(job #2428385)
Utilizator | Arhire Andrei Andrei-27 | Data | 5 iunie 2019 00:54:17 |
---|---|---|---|
Problema | Twoton | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva ICPC | Marime | 0.48 kb |
#include <bits/stdc++.h>
using namespace std ;
int n , cnt = 1 , best ;
ifstream in ("twoton.in") ;
ofstream out ("twoton.out") ;
void YAA ( int i ) {
int x ;
in >> x ;
if ( i == n ) {
best = x ;
return ;
}
YAA ( i + 1 ) ;
if ( x >= best ) {
cnt <<= 1 ;
} else {
best = x ;
}
++ cnt ;
if ( cnt >= 19997 )
cnt -= 19997 ;
}
int main()
{
in >> n ;
YAA ( 1 ) ;
out << cnt ;
}