Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0

dung

36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601
KillerZackGG_
Humiliation_XI
0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0

include <bits/stdc++.h>

using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

long long a, b, s = 0, x, j, n;

cin >> a >> b;
x = a;
j = b;

while (a != b) 
{
    if (a > b)
        a = a - b;
    else
        b = b - a;
}
n = a;

a = x;
b = j;

for (int i = 1; i <= sqrt(n); i++) {
    if (a % i == 0) {
        if (b % i == 0) {
            x = 0;
            j = i;
            while (j != 0) 
            {
                x = x + j % 10;
                j = j / 10;
            }
            if (x > s) s = x;

            j = n / i;
            if (b % j == 0) {
                x = 0;
                while (j != 0) {
                    x = x + j % 10;
                    j = j / 10;
                }
                if (x > s) s = x;
            }
        }
    }
}

cout << s;
return 0;

}

36601 0 0
36601 0 0
36601
Maycode
Mai Le
0 0

hi

36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601
Phhonglinh
Phan thị hồng lĩnh
0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601
dauhamy2009
Đậu Thị Hà My
0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0

lop 9H thcs VanLuong
VoDangKhoa
cần help đệ quy quay lui, hoán vị, quy hoạch động 😭

36601 0 0
36601 0 0

dsada

36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0
36601 0 0

include <bits/stdc++.h>

using namespace std;

define ll long long

define nmax 1000007

ll A[1000006];
ll tknp(ll n,ll A[],ll c,ll q)
{
ll l=q,r=n,m=1,kq=0,x=c+q,dem=0;
while(l<=r)
{
m=(l+r)/2;
if(A[m]<=x)
{
if(x>A[m]&&A[m]+q>c&&A[m]+c>q){
dem++;
kq=A[m];}
l=m+1;
}
else
r=m-1;
}
return dem;
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n,dem=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>A[i];
}
for(int i=1;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
if(tknp(n,A,A[i],A[j])>0){
dem+=tknp(n,A,A[i],A[j]);
}
}
}
cout<<dem;
}

36601 0 0
36601 0 0
36601 0 0