Cod sursa(job #2765483)

Utilizator stef0n2005Andon Stefan stef0n2005 Data 27 iulie 2021 10:33:16
Problema Fractii Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.67 kb
#include "bits/stdc++.h"
using namespace std;
int main(){
    ifstream in;
    ofstream out;
    in.open("fractii.in");
    out.open("fractii.out");
    int n, result = 0;
    in>>n;
    vector<float> exist;
    vector<int> existInt;
    for(int i = 1; i<=n; i++){
        for(int j = 1; j<=n; j++){
            float m = static_cast<float>(i) / static_cast<float>( j);
            sort(exist.begin(), exist.end());
            if(!binary_search(exist.begin(), exist.end(), m)){
                
                    exist.push_back(m);
                    
                    result++;
               
            }
        }
    }
    out<<result;
    in.close();
    out.close();
}