Cod sursa(job #3273003)

Utilizator DobrePetruDobre Petru Daniel DobrePetru Data 1 februarie 2025 08:43:27
Problema Fractii Scor 0
Compilator cpp-64 Status done
Runda cex_8 Marime 0.82 kb
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int n,rez;
int cmmdc(int a,int b)
{
    int r=a%b;
    while(r)
    {
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int main()
{
    fin>>n;
    rez=n;
    for(int i=2; i<=n; i++)
    {
      if(i%2==1) rez+=log(n)+1;
        else if(i%2==0) 
        {
            if(n%2==1) rez+=n/2+1;
            else rez+=n/2;
        }
    }
  fout<<rez+1;
    return 0;
}