A-Masala

Orifxon Husanov [ NamPM ] Yechimi :

C++ da 

#include <bits/stdc++.h>
#include <iomanip>
#include <cmath>

using namespace std;
#ifdef LOCAL
#include "debug.cpp"
#else
#define debug(...) 42;
#endif

using namespace std;

#define ll long long
#define pb push_back
#define PI 3.14159265358979323846264338327950288419716939937510

#define llmax 1e18
#define inf 1e9+2
const int MOD = 1000000007;
#define vi vector<int>
#define vll vector<ll>
#define ff first
#define ss second
#define bound 10000001
bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; }
#define all(a) (a).begin(), (a).end()
#define rep(i, a, b) for(ll i=a; i<b; i++)

vll input(ll n){vll a;rep(i,0,n){ll x;cin >> x;a.pb(x);}return a;}
ll minn(vll a, ll n){ll mn = 1e18;rep(i,0,n){mn = min(mn, a[i]);}return mn;}
ll maxx(vll a, ll n){ll mx = 0;rep(i,0,n){mx = max(mx, a[i]);}return mx;}
ll sum(vll a, ll n){ll sm = 0;rep(i,0,n){sm+=a[i];}return sm;}
 

int findmex(vector<int> v, int n){
   unordered_set<int> s;
   for(int i=0;i<n+2; i++){
       s.insert(i);
   }
   for(auto val:v) if (s.find(val)!=s.end()) s.erase(val);
   return *min_element(all(s));}

struct Point{
   int x, y;
};
long long lcm(ll a, ll b)
{
   return (a / __gcd(a, b)) * b;
}
#define int ll

void solve() {
   int n;
   cin >> n;
   vi a;
   for (int i=1; i<=sqrt(n); i++) { 
       if (n%i == 0) 
       { 
           if (n/i == i)a.pb(i);
           else{
               a.pb(i);
               a.pb(n / i);
           }
       } 
   } 
   int cnt = 0;
   rep(i,0,a.size()){
       rep(j,0,a.size()){
           rep(k,0,a.size()){
               if(a[i] * a[j] * a[k] == n){
                   if(i != j && j != k && k != i)cnt++;
               }
           }
       }
   }
   if(cnt == 0)cout << -1;
   else cout << cnt;
}


signed main()

{
#ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
#endif
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int t;  
   t = 1;
   //cin >> t;
   while(t--){
   solve();
   cout << '\n';
   }
/* Orifkhon Telegram username : @orifkhon_husanov_off */

}

 

B-Masala

Pythonda  S̶h̶a̶m̶s̶i̶d̶d̶i̶n̶ ̶Q̶u̶t̶l̶i̶m̶u̶r̶a̶t̶o̶v̶ yechimi

n=int(input())
s=n**2-n+2
print(((s+s+2*(n-1))*((s+2*(n-1)-s+1)//2+1)//2)%1000000007)
print(s+2*(n-1))

 

C-Masala

Pythonda Davronbek Dilshodov yechimi

n=int(input())
print("{:.8f}".format(round(n/(n+1),8)))
 

 

D-masala

Pythonda
[Al-Xorazmiy] -> Usmonov Muhammadaziz yechimi.
a = int(input())
print('{:.8f}'.format(a/(a+1)))

 

C++ da

Orifxon Husanov [ NamPM ] Yechimi

 

#include <bits/stdc++.h>
#include <iomanip>
#include <cmath>

using namespace std;
#ifdef LOCAL
#include "debug.cpp"
#else
#define debug(...) 42;
#endif

using namespace std;

#define ll long long
#define pb push_back
#define PI 3.14159265358979323846264338327950288419716939937510

#define llmax 1e18
#define inf 1e9+2
const int MOD = 1000000007;
#define vi vector<int>
#define vll vector<ll>
#define ff first
#define ss second
#define bound 10000001
bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; }
#define all(a) (a).begin(), (a).end()
#define rep(i, a, b) for(ll i=a; i<b; i++)

vll input(ll n){vll a;rep(i,0,n){ll x;cin >> x;a.pb(x);}return a;}
ll minn(vll a, ll n){ll mn = 1e18;rep(i,0,n){mn = min(mn, a[i]);}return mn;}
ll maxx(vll a, ll n){ll mx = 0;rep(i,0,n){mx = max(mx, a[i]);}return mx;}
ll sum(vll a, ll n){ll sm = 0;rep(i,0,n){sm+=a[i];}return sm;}
 

int findmex(vector<int> v, int n){
   unordered_set<int> s;
   for(int i=0;i<n+2; i++){
       s.insert(i);
   }
   for(auto val:v) if (s.find(val)!=s.end()) s.erase(val);
   return *min_element(all(s));}

struct Point{
   int x, y;
};
long long lcm(ll a, ll b)
{
   return (a / __gcd(a, b)) * b;
}
#define int ll

void solve() {
   double n;
   cin >> n;
   cout << fixed << setprecision(8) << 1 - (1 / ( 1 + n));
}


signed main()

{
#ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
#endif
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int t;  
   t = 1;
   //cin >> t;
   while(t--){
   solve();
   cout << '\n';
   }
/* Orifkhon Telegram username : @orifkhon_husanov_off */

}

 

 

C++da  Soliha Dagarova yechimi C++da

 

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
     long  double n; cin >> n;
     cout << fixed << setprecision(8) << n/(n+1) << endl;
     return 0;
}