Rezultati

Up. imeNalogaJezikRezultatČas oddaje
scoreoutofboundsexception-2019 Ocenjevanje univerz C++ 100/100OK 24. apr '19 @ 17:03

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 10/10 3,156 MiB 0,073 s OK
#2 [več] 10/10 3,129 MiB 0,130 s OK
#3 [več] 10/10 3,004 MiB 0,004 s OK
#4 [več] 10/10 3,129 MiB 0,085 s OK
#5 [več] 10/10 3,156 MiB 0,032 s OK
#6 [več] 10/10 3,125 MiB 0,091 s OK
#7 [več] 10/10 3,004 MiB 0,171 s OK
#8 [več] 10/10 3,004 MiB 0,159 s OK
#9 [več] 10/10 3,004 MiB 0,039 s OK
#10 [več] 10/10 3,156 MiB 0,144 s OK

Ocenjevani program (uni.cpp):
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main(){
	int n, a, b, na, nb;
	double mx = 1, mn = 0;
	cin>>n>>a>>b;
	
	
	for (int i = 0; i < n-1; i++){
		cin>>na>>nb;
		if (a - na - b + nb == 0){
			if (nb > b){
				cout<<"Slabe metrike"<<endl;
				return 0;
			}
		}
		else if (a - na - b + nb < 0){
			mx = min(mx, ((double)(nb - b)) / ((double)(a - na - b + nb)));
		}
		else {
			mn = max(mn, ((double)(nb - b)) / ((double)(a - na - b + nb)));
		}
	}
	
	if (mn > mx) {
		cout<<"Slabe metrike"<<endl;
		return 0;
	}
	
	double x = (mx + mn) / 2;
	printf("%.9lf %.9lf\n", x, (1-x));
	//cout<<x<<" "<<(1 - x)<<endl;
}