Algorithms UZ
Відкрити в Telegram
Kanal egasi: @Bekzhanov_rasul “ Dunyoda ilmdan boshqa najot yoq va bolmagay. ” Imom Al-Buxoriy. Muhokama gruh: @Programmer_TK_Chat
Показати більше202
Підписники
Немає даних24 години
Немає даних7 днів
Немає даних30 днів
Архів дописів
// 54-misol C++
#include<bits/stdc++.h>
using namespace std;
int main(){
long long N;
cin>>N;
if(N>=1 && N<=1e18){
if(N%2==0) {
cout<<"Husan";
}
else
cout<<"Hasan";
}
}
// 39-misol PY
x=int(input())
j= x - (((x % 100 ) + 100 ) // 2)
i= x- ((x % 100 ) //2)
if(i!=j):
if(i<j):
print(i,j)
else:
print(j,i)
else:
print(i)
Chanel: @JK_Programming
//127-misol c++
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++)
cin >> a[i];
sort(a.begin(), a.end());
cout << a[(n - 1) / 2];
}
// 385-misol C++
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, a, b, d;
cin >> n >> a;
if(n>a)
b=n;
else
b=a;
d=__gcd(6 - b + 1 , 6);
cout << (1 + 6 - b) / d <<"/" << 6 / d << endl;
}
// 47-misol C++
#include <iostream>
#include <cmath>
using namespace std;
unsigned int daraja2(unsigned int x)
{
unsigned int count = 0;
while(x > 0) {
x = x / 2;
count++;
}
return pow(2,count);
}
int main()
{
unsigned int n, s=0, k, t;
cin >> t;
for(int i = 0; i < t; i++) {
cin >> n;
k = daraja2(n);
while(k > 0) {
s += n / k;
n = n % k;
k = k / 2;
}
cout << s << endl;
s = 0;
}
}
// 161-misol C++
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long Y;
cin >> Y;
if(Y <= 1917)
{
if(Y % 4 == 0)
cout << "12.09." << Y;
else
cout << "13.09." << Y;
}
else if(Y >= 1919)
{
if(Y % 400 == 0 || Y % 4 == 0 && Y % 100 != 0)
cout << "12.09." << Y;
else
cout << "13.09." << Y;
}
else if(Y == 1918)
{
cout << "26.09." << Y;
}
}
//215-misol c++
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
long int n;
cin >> n;
if( ( n + 1 ) % 4 == 0 || n % 4 == 0)
cout << "B" << endl;
else
cout << "A" << endl;
return 0;
}
// 12-misol C++
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
long long int n, soniTub = 1;
cin >> n;
bool ha = true;
for (int j = 3; j <= n; j += 2)
{
ha = true;
for (int i = 2; i <= sqrt(j); i++)
{
if (j % i == 0)
{
ha = false;
break;
}
}
if (ha)
soniTub++;
}
if (soniTub % 2 != 0)
cout << "Ali";
else
cout << "Bobur";
}
//183-misol c++
#include <bits/stdc++.h>
using namespace std;
bool solishtir(string s1, string s2)
{
int s1l = s1.length(), s2l = s2.length();
if (s1l != s2l)
return s1l < s2l;
return s1 < s2;
}
int main()
{
vector<string> vec;
string son;
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> son;
vec.push_back(son);
}
sort(vec.begin(), vec.end(), solishtir);
for (auto i : vec)
{
cout << i << endl;
}
}
Kanalda obunachilar ko'paysa ko'proq yechimlar tashlanadi..!!!
Kanal yaxshi bo'lsa Premium reaksiya bosamiz🎗 🔥🔥🔥
@JK_Programming
//77-misol c++
#include <iostream>
using namespace std;
int main()
{
int x, y, n = 1;
cin >> x >> y;
n += (100 - x) / (x - 3 * y);
if((100 - x) % (x - 3 * y) != 0)
{
n++;
}
cout << n;
}
// 293-misol c++
#include <iostream>
#include <string.h>
using namespace std;
string ikki(long n)
{
if (n < 1)
return "";
return ikki(n / 2) + to_string(n % 2);
}
int main()
{
string s1;
cin >> s1;
cout << s1.length() << endl;
for (int i = 0; i < s1.length(); i++)
{
cout << ikki((int)s1[i]) << endl;
}
}
// 24-misol C++
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
if(n % 10 >= 7||n % 10 == 4||n % 10 == 3)
cout << n / 5 + 1;
else
cout << n / 5;
}
Repost from N/a
C++ dasturlash tilida 1/2 bilan 1.0/2 ni farqi bormi?
Javobga tushunmagan bo'lsaning izoxda qoldiring..!?
