#include <iostream> #include <cmath> #include <utility> #include <vector> using namespace std; typedef pair<int, int> pa; int main() { cout<<"Celkový počet gólov: "; int n; cin >> n; if (!n) { cout << "Index napínavosti: 0"<<endl; return 0; } cout<<"Zadaj postupne góly - 0 prvé mužstvo, 1 druhé mužstvo: "; pa d(0, 0); vector<pa> x; for (int i=0; i<n; i++) { bool c; cin>>c; d.first+=!c; d.second+=c; x.push_back(d); } double min = atan2(1.0, 0.0), max = atan2(0.0, 1.0); for (unsigned i=0; i<x.size(); i++) { min<?=atan2((double)x[i].second+d.second, (double)x[i].first+d.first); max>?=atan2((double)x[i].second+d.second, (double)x[i].first+d.first); } cout<<endl<<"Index napínavosti: "<<max-min<<endl; cout<<"Index napínavosti finále MS 2002 Slovensko - Rusko: 0.244979."<<endl; }