# data[].attributes.body
https://drive.google.com/drive/folders/11Y6JRoPxNYoLv_I3JPW1fCu-FE_DKYWP?usp=sharing

# data[].attributes.attachment_link.description
Get access to files anywhere through secure cloud storage and file backup for your photos, videos, files and more with Google Drive.

# data[].attributes.body
https://www.youtube.com/watch?v=M3v7Ie9hu0s

# data[].attributes.attachment_link.title
#8 [C++]. Mảng Một Chiều Trong Ngôn Ngữ Lập Trình C++ Và Các Bài Toán Thường Gặp

# data[].attributes.body
https://vi.wikibooks.org/wiki/B%C3%A0i_t%E1%BA%ADp_C%2B%2B/M%E1%BA%A3ng/Li%E1%BB%87t_k%C3%AA_c%C3%A1c_ph%E1%BA%A7n_t%E1%BB%AD_%C3%A2m

# data[].attributes.attachment_link.description
Trang dành cho người dùng chưa đăng nhập tìm hiểu thêm

# data[].attributes.attachment_link.readable_text
#include <bits/stdc++.h>
using namespace std;
int n;
int a[1001],dem=0,tg=0;
bool nto(int n)
{
    if(n<2) return false;
    for (int i=2;i*i<=n;i++)
    if (n%i==0) return false;
    return true;
}
int main()
{
    freopen("tbcnto.inp","r",stdin);
    freopen("tbcnto.out","w",stdout);
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    for (int i=1;i<=n;i++)
        if (nto(a[i])==true)
        {
            dem++;
            tg=tg+a[i];
        }
    float tbc=tg/dem;
    cout<<tbc;
    return 0;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n;
int a[1001],dem=0;
int main()
{
    freopen("bai3.inp","r",stdin);
    freopen("bai3.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    int min=a[1];
    for(int i=2;i<=n;i++)
        if (a[i]<min)
            min=a[i];
    for(int i=1;i<=n;i++)
        if(a[i]==min)
            dem++;
    cout<<dem;
}

# data[].attributes.body
làm trên cấu trúc bài 3 , nên tên nó là bài 3 nhá ,

# data[].attributes.body
bài 6 nhưng làm trên cấu trúc của bài 3 , đỡ phải viết lại

# data[].attributes.attachment_link.readable_text
#include <bits/stdc++.h>
using namespace std;
int n,k;
int a[1001];
int main()
{
    freopen("bai3.inp","r",stdin);
    freopen("bai3.out","w",stdout);
    cin>>n;
    int dem=0;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    cin>>k;
    for (int i=1;i<=n-1;i++)
         for (int j=i+1;j<=n;j++)
            if (a[i]+a[j]==k)
                dem++;
    cout<<dem;
    return 0;


}


# data[].attributes.attachment_link.readable_text
#include <bits/stdc++.h>
using namespace std;
int n,k;
int a[1001];
int main()
{
    freopen("bai7.inp","r",stdin);
    freopen("bai7.out","w",stdout);

    //nhap n va day
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    //xu li tim do chenh lech nn
    int min=10000;
    for (int i=1;i<=n-1;i++)
        for (int j=i+1;j<=n;j++)
          if(abs(a[i]-a[j])<min)          min=abs(a[i]-a[j]);
    //in kq
    cout<<min;

}

# data[].attributes.body
bài 8 trang 98

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
#define N 1001
#define ll long long
using namespace std;
ll a[N],n;
int main()
{
    freopen("bai7.inp","r",stdin);
    freopen("bai7.out","w", stdout);
    cin>>n;
    for (int i= 1; i<= n ; i++) cin>>a[i];
    //sap xep 1

       for (int i=1; i<=n-1; i++)
        for (int j=i+1; j<=n ; j++)
        if (a[i]<a[j]) swap(a[i],a[j]);
  //sap xep 2
    for (int j=n; j>=2; j--)
        for (int i=1; i<=j-1 ; i++)
        if (a[i]<a[i+1]) swap(a[i],a[i+1]);
  //sap xep 3
     sort(a+1, a+n+1); // sx tang dung cho day đánh stt từ 1
 //sort(a, a+n); // sx tang dung cho day đánh stt từ 0

    for (int i= 1; i<= n; i++)
        cout<<a[i]<<" ";
    return 0;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
#define N 1001
#define ll long long
using namespace std;
ll a[N],n;
bool sosanh(int a, int b)
{
    return a> b ; // nếu a>b: sxep giảm; nếu a<b: sxep tăng
}
int main()
{
    freopen("bai7.inp","r",stdin);
    freopen("bai7.out","w", stdout);
    cin>>n;
    for (int i= 1; i<= n ; i++) cin>>a[i];
    sort(a+1,a+n+1,sosanh);

    for (int i= 1; i<= n; i++)
        cout<<a[i]<<" ";
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int a,b;
int ucln(int a,int b)
{
    while(b>0)
    {
        int du=a%b;
        a=b;
        b=du;
    }
    return a;
}
int main()
{
    freopen("b4.inp","r",stdin);
    freopen("b4.out","w",stdout);
    int t;
    cin>>t;
    for (int i=1;i<=t;i++)
       {
        cin>>a>>b;
        if (ucln(a,b)%2==0) cout<<"even"<<endl;
        else cout<<"odd"<<endl;
       }
    return 0;
}

# data[].attributes.attachment_link.readable_text
#include <bits/stdc++.h>
using namespace std;
int cp(int n)
{
    int x=int(sqrt(n));
    if(x*x==n)  return true;
    else        return false;

}
int main()
{
    int n;
    cin>>n;
    int a=n;
    while (cp(a)==false) a++;
    cout<<a;

}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
    cin>>n;
    int dem=0;
    int i=2;
    while(n!=1)
    {
        while(n%i==0)
        {
            n=n/i;
            dem++;
        }
        i++;
    }
    if(dem==3)
        cout<<"1";
    else cout<<"0";
    return 0;

}

# data[].attributes.attachment_link.readable_text
#include <bits/stdc++.h>
#define Nmax 1000000
using namespace std;
int c[Nmax];
int n;
void phantich(int n)
{
    fill(c,c+Nmax+1,0);
    for (int i = 2;i*i<=n; i++)
    {
        while (n%i==0)
        {
            c[i]++;
            n=n/i;
        }
    }
    if (n>1) c[n]++;
}
int main()
{
    #define taskname ""

    if (fopen(taskname".inp", "r")) {
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }
    cin.tie(0)->sync_with_stdio(0);
    cin>>n;
    phantich(n);
    for (int i=1; i*i<=n; i++)
            if(c[i]>0) cout<<i<<" "<<c[i]<<endl;
    if (c[n]>0) cout<<n<<" "<<c[n];
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
long long f[86],x,n;
bool fbnc(long long n)
{
    bool kt=false;
    for(int i=1;i<=85;i++)
        if(n==f[i])
        {
            kt=true;
            break;
        }
    return kt;
}
int main()
{
    f[1]=1; f[0]=0;
    for(int i=2;i<=85;i++)
        f[i]=f[i-1]+f[i-2];
    cin>>n;
    for(int i=1;i<=n;i++)
    {

        cin>>x;
        if(fbnc(x)==true) cout<<"yes"<<endl;
        else cout<<"no"<<endl;

    }
 return 0;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n;
long long f[86];
bool fb(long long n)
{
    bool kt=false;
    for (int i=1;i<=85;i++)
        if (n==f[i])
    {
        kt=true;
        break;
    }
    return kt;
}
bool nto(int n)
{
    if(n<2) return false ;
    for (int i=2;i*i<=n;i++)
        if(n%i==0) return false;
    return true;
}
int tcs(int n)
{
    int s=0;
    while(n!=0)
    {
        int du=n%10;
        n=n/10;
        s=s+du;


    }
    return s;
}
int main()
{
    f[0]=0;f[1]=1;
    for (int i=2;i<=85-;i++)
        f[i]=f[i-1]+f[i-2];
    cin>>n;
    for (int i=1;i<=n;i++)
            if(nto(i)==true&&fb(tcs(i))==true)
                cout<<i<<" ";
    return 0;

}

# data[].attributes.body
#include <iostream>
#define Nmax 10000
using namespace std;
int a[Nmax];
void sangnto()
{
for (int i=0; i<=Nmax; i++) a[i]=1;
a[0]=a[1]=0;
for (int i=2; i*i<=Nmax; i++)
if (a[i]==1)
for (int j=i*i; j<=Nmax; j+=i)
a[j]=0;
}
int main() {
sangnto();
for (int i=2; i<=Nmax; i++)
if(a[i]==1) cout<<i<<" ";
return 0;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n,tong,dem=0,a,b,c,d,e;
int main ()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a>>b>>c>>d>>e;
        tong=a+b+c+d+e;
        if (tong>=3) dem++;
    }
    cout<<dem;


}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n,a[1000001];
bool dxung(int n,int a[])
{
    bool kt=true;
    for (int i=1;i<=n/2;i++)
        if(a[i]!=a[n-i+1]) kt=false;
    return kt;
}
bool daytang(int a[],int n)
{
    kt= true;
    for(int i = 1; i<= n-1; i++)
        if (a[i]>a[i+1]) kt = false;
    return kt;

}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(dxung(n,a)==true) cout<<"YES";
        else cout<<"NO";
    return 0;

}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n;
bool nto(int n)
{
    if(n<2) return false;
    for(int i=2;i*i<=n;i++)
        if(n%i==0) return false;
    return true;
}
int main()
{
    cin>>n;
    int a=n,b=n;
    while(nto(a)==false) a--;
    while(nto(b)==false) b++;
    cout<<a<<" "<<b;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int dn (int n)
{

    int s=0;
    while(n!=0)
    {
        int du=n%10;
        s=s*10+du;
        n=n/10;
    }
    return s;
}
bool nto(int x)
{
    if(x<=1)return false;
    for(int i=2;i*i<=x ;i++)
    if(x%i==0)return false;
    return true;
}
int main()
{
 //   freopen("findnum.inp","r",stdin);
   // freopen("findnum.out","w",stdout);
    int x,a,b;
    cin>>a>>b;
int    dem=0;
    for (int x =a; x<=b ; x++)
        if(nto(dn(x))==true)dem++;
    cout<<dem;

}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n,dem=0,a[200001];
int sodep(int n)
{

    int du,dv=n%10,dcs=0,ddv=0;
    while(n!=0)
    {
        dcs++;
        du=n%10;
        n=n/10;
        if(du==dv)  ddv++;
    }
    if(ddv==dcs)    return true;
    else        return false;
}
int main ()
{

freopen("nicenum.inp","r",stdin);
freopen("nicenum.out","w",stdout);
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(sodep(a[i]+a[j])==true)
            dem++;
cout<<dem;
return 0;
}


# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int a[1000001];
bool sdep(int n)
{
    int dem=0,dcs=0;
    int dvi=n%10;
    while (n!=0)
    {
        int du=n%10;
        n=n/10;
        if(dvi==du) dem++;
        dcs++;

    }
    if(dem==dcs)
        return true;
    else return false;
}
int main()
{

    freopen("nicenum.inp","r",stdin);
    freopen("nicenum.out","w",stdout);
    int n;
    cin>>n;
    int d=0;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n+1;i++)
        for(int j=i+1;j<=n;j++)
            if(sdep(a[i]+a[j])==true) d++;
    cout<<d;
    return 0;

}

# data[].attributes.body
tuanb1

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n,a,b,c,d,e,f,g,h;
int main()
{
    freopen("dice4.inp","r",stdin);
    freopen("dice4.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a>>b>>c>>d>>e>>f>>g>>h;
    cout<<"yes"<<endl<<"no"<<endl<<"no";
    return 0;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("dice4.inp","r",stdin);
    freopen("dice4.out","w",stdout);
    int n,a,s,d,f,g,h,j,k;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a>>s>>d>>f>>g>>h>>j>>k;
    cout<<"yes"<<endl<<"no"<<endl<<"no";
    return 0;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n,a[10000001];
bool dxung(int n,int a[])
{
    bool kt=true;
    for(int i=1;i<=n/2;i++)
        if(a[i]!=a[n-i+1])  kt=false;
    return kt;
}
/*bool sodep(int n)
{
    if(n<10) return true;
    for(int i=10;i<=n;i++)

}
int main()
{
    freopen("NICENUM","w",stdin);
    freopen("NICENUM","r",stdout);
}*/
int main()
{
    int dem=0;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for (int i=1;i<=n;i++)
        if (dxung(n,a)=true)
            dem++;
    cout<<dem;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("dice4.inp","r",stdin);
    freopen("dice4.out","r",stdin);
    int n,a,b,c,d,e,f,g,h;
    for(int i=1;i<=n;i++)
    cin>>n;
    cin>>a>>b>>c>>d>>e>>f>>g>>h;
    cout<<"yes"<<endl<<"no"<<endl<<"no";
    return 0

}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n,dem=0,a[20001];
int sodep(int n)
{
    int du,dv=n%10,dcs=0,ddv=0;
    while(n!=0)
    {
        dcs++;
        du=n%10;
        n=n/10;
        if(du==dv) ddv++;
    }
    if(ddv==dcs)  return true;
    else return false;
}

int main()
{
    freopen("nicenum.inp","r",stdin);
    freopen("nicenum.out","w",stdout);
    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(sodep(a[i]+a[j])==true)
                dem++;
    cout<<dem;
    return 0;
}

# data[].attributes.body
Số tam giac

# data[].attributes.body
Thay chu so

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int t;
long long n;
int ddu1(int n)
{
    int dem=0;
    while(n!=0)
    {
        int du=n%2;
        n=n/2;
        if(du==1) dem++;
    }
    return dem;
}
int main()
{
    freopen("tcl.inp","r",stdin);
    freopen("tcl.out","w",stdout);
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        cin>>n;
        if(ddu1(n)%2!=0) cout<<"odd"<<endl;
        else cout<<"even"<<endl;
    }
    return 0;

}

# data[].attributes.body
De vp 10 20-21

# data[].attributes.body
De hsg 11 20-21

# data[].attributes.body
De 12 vp 20-21

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
bool bacthang(int n)
{
    int k;
    bool kt=true;
    if(n<10)    return false;
    else
    {
        int x=n%10;
        while(n!=0)
        {
            int du=n%10;
            n=n/10;
            if(x<du)    kt=false;
            else x=du;

        }return kt;
    }

}
int main()
{
    int n,dem=0;
    long long a[1000];
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
        if(bacthang(a[i])==true)
            dem++;
            cout<<dem;
        return 0;
}


# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n,dem=0;
int a[101];
int tongcs(int n)
{
    int s=0;
    while(n!=0)
    {
        int du=n%10;
        n=n/10;
        s=s+du;
    }
    return s;

}
bool kthh(int n)
{
    int s=0;
    for(int i=1;i<=n/2;i++)
        if(n%i==0)
            s=s+i;

    if(n!=s)    return false;
    else return true;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
        if(kthh(tongcs(a[i]))==true)
            dem++;
    cout<<dem;
    return 0;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
int n;
bool nto(int n)
{
    if(n<2) return false;
    for (int i=2;i*i<=n;i++)
        if(n%i==0) return false;
    return true;
}
int dngc(int n)
{
    int kq=0;
    while(n!=0)
    {
        int du=n%10;
        n=n/10;
        kq=kq*10+du;

    }
    return  kq;
}
int main()
{cout<<dngc(34);
    cin>>n;

    if(nto(n)==true&&nto(dngc(n))==true) cout<<"1";
    else cout<<"0";
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
string a,b;
string csl(string a, string b)
{
    while(a.size()<b.size())
        a='0'+a;
    while(b.size()<a.size())
        b='0'+b;
    int nho=0;
    int n=a.size();
    string kq="";
    for(int i=n-1;i>=0;i--)
    {
        int tong=a[i]-48+b[i]-48+nho;
        kq=char(48+tong%10)+kq;
        nho=tong/10;
    }
    if (nho>0) kq='1'+kq;
    return kq;
}
int main()
{
    cin>>a;
    cin>>b;
    cout<<csl(a,b);

}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
string a,b;
string hieusl(string a,string b)
{
    while(a.size()<b.size())
        a='0'+a;
    while(b.size()<a.size())
        b='0'+b;
    int muon=0,hieu=0;
    int n=a.size();
    string kq="";
    for(int i=n-1;i>=0;i--)
    {
        int hieu=a[i]-b[i]-muon;
        if(hieu<0)
        {
            muon=1;
            hieu=hieu+10;
        }
        kq=char(hieu+48)+kq;

    }
    while (kq[0]=='0')
        kq.erase(0,1);
    return kq;
}
int main()
{
    cin>>a;
    cin>>b;
    cout<<hieusl(a,b);

}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
ll a[51];
int demuoc(ll n)
{
    int d=0;
    for (int i=1;i<=n;i++)
        if(n%i==0) d++;
    return d;
}
int main()
{
    //freopen("sodep.inp","r",stdin);
    //freopen("sodep.out","w",stdout);
    cin>>n;
    //cout<<demuoc(40);
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
        if(a[i]%demuoc(a[i])==0) cout<<"Co"<<endl;
        else cout<<"Khong"<<endl;
    return 0;
}

# data[].attributes.attachment_link.readable_text
#include<bits/stdc++.h>
using namespace std;
string a[5001];
int n,x;
string chuyen2(int n)
{
    string s="";
    while(n!=0)
    {
        int du=n%2;
        n=n/2;
        s=char(du+48)+s;
    }
    return s;
}
bool kttd(string a, string b)
{
    while (a.size()<b.size()) a='0'+a;
    while (a.size()>b.size()) b='0'+b;
    int d=0;
    for(int i=0; i<a.size(); i++)
        if(a[i]!=b[i]) d++;
    if (d<=1) return true;
    else return false;
}
int main()
{
    freopen("dl.inp","r", stdin);
    freopen("dl.out","w",stdout);
    cin>>n;
    for(int i = 1; i<= n ;i++)
    {
        cin>>x;
        a[i]=chuyen2(x);

    }
    int d=0;
    for(int i=1; i<n ; i++)
        for (int j=i+1; j<=n; j++)
        if(kttd(a[i],a[j])==true) d++;
    cout<<d;
}
