Cod sursa(job #2691087)

Utilizator stef0n2005Andon Stefan stef0n2005 Data 26 decembrie 2020 23:34:13
Problema Fractii Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <bits/stdc++.h>
using namespace std;

int main () {
  ofstream out("fractii.out");
  ifstream in("fractii.in");
  int n, r = 0;
  vector<float> v1;
  in>>n;
  for(float p = 1; p<=n; p++){
    for(float q = 1; q<=n; q++){
      sort(v1.begin(), v1.end());
      
      if(binary_search (v1.begin(), v1.end(), p/q)){
      } else{
        v1.push_back(p/q);
        r++;
      }
      
    }
  }
    out<<r;
  out.close();
  in.close();
}