Cod sursa(job #479584)
| Utilizator | Data | 24 august 2010 15:33:08 | |
|---|---|---|---|
| Problema | Statistici de ordine | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.4 kb |
# include <fstream>
using namespace std;
const char FIN[] = "sdo.in", FOU[] = "sdo.out" ;
const int MAX = 3000004 ;
int A[MAX];
int N, K;
void read_data ( void ) {
ifstream f ( FIN ) ;
f >> N >> K ;
for ( int i = 1; i <= N; ++i ) {
f >> A[i] ;
}
}
int main ( void )
{
read_data () ;
nth_element ( A + 1, A + K, A + N + 1 ) ;
ofstream g ( FOU ) ;
g << A[K] ;
}
