# data[].attributes.body
//bai1
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a , t; cout << "a="; cin >> a; cout << "t= "; cin >>t;
if(t>0 && a>0) {
cout <<"tien thanh toan: " << a*t;
}

}

===============================

//bai2

#include <bits/stdc++.h>
using namespace std;
int main(){
float x, y, z;
cout << "x= "; cin >> x;
cout << "y= "; cin >> y;
cout << "z= "; cin >> z;
float min = x;
if(min > y) min = y;
if(min > z) min = z;
cout << "So nho nhat= " << min;
float tln = x* y;
if (tln < y*z ) tln = y*z;
if (tln < x*z) tln = x*z;
cout << "\nTich lon nhat= " << tln;

}

================================
// bai 3

#include <bits/stdc++.h>
using namespace std;
int main()
{   int demuoc = 0;
int n; cin >> n;
for (int i = 2; i<= sqrt(n) ; i++)
if (n%i==0) demuoc++;
if (demuoc == 0 && n > 1) cout << n << " la so nguyen to";
else{

int a = 2;
while(n > 1)
{
if(n % a == 0){
cout << " " << a;
n /= a;
}
if (n % a != 0) a++;
}

}
}

===============================

// bai4

#include <bits/stdc++.h>
using namespace std;
int a[10004];
int s[1000006];
int main() {
int n; cin >> n;
if (n % 2 != 0){
for (int i = 1; i <= n; i++)
{
cout << "a[" << i << "]";
cin >> a[i];}

int k;
cout << "nhap k: ";
cin >> k;

int solon = 0;
for (int i = 1; i <= k; i++)
solon += a[i];
for (int i = 2; i<= n - k + 1; i++)
{
int s= 0;
for (int j = i; j<= k+ i -1; j++ )
s+= a[j];
if (s > solon) solon = s;
}
cout << "tong lien tiep lon nhat: "<< solon;

for (int i = 1; i <= n-1; ++i)
{
for (int j = i + 1;j <= n ; j++)
{
if(a[i] > a[j])
{
int tam = a[i];
a[i] = a[j];
a[j] = tam;}

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

}

cout << "\nphan tu giua: " << a[(n+1) / 2] ;
}
}

==========================================
//bai5

#include <bits/stdc++.h>
using namespace std;
int a[1000006];
int giua;
int c;
int main(){
int n, k;
cout << "nhap n: ";
cin >> n;
cout << "nhap k: ";
cin >> k;
for (int i = 1; i <= n; i++)
cin >> a[i];
int solon = a[1];
for (int i = 2 ; i <= n ; i++)
if (solon < a[i]) solon = a[i];
int d = 1;
c = solon;

while(d <= c){
giua = ( d + c ) / 2;
int dem = 0;
for (int i = 1; i <= n ; i++)
dem += a[i] / giua;
if(dem == k) {
cout << "cac doan go can cat la: " << giua;
break;}
if (dem > k) d= giua + 1;
if (dem < k) c = giua - 1;
}
}

# data[].attributes.body
//Bai 1
#include<bits/stdc++.h>
using namespace std ;
int main ()
{
int a, b;
cin>>a>>b;
cout << fixed << setprecision(2) <<(float)(a + b) / 2;
}
//bai 2
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i = 10; i >= 1; i--)
cout<<n*i<<"  ";
}
//bai3
#include<bits/stdc++.h>
using namespace std;
int main(){
int toan, van, anh, tin;
float tong=0;
cin>>toan>>van>>anh>>tin;
tong= toan + van + anh + (tin*2);
cout  << "Diem tong cong : "<<tong<<"\n";
if(tong >=30 && toan > 5 && van > 5 && anh > 5 && tin > 5){
cout<<"Dau"<<"\n";
}
else{
cout<<"Hong"<<"\n";
}
}
//bai 4
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, s = 0;
cin>>n;
int tw;
cin>>tw;
int a[n];
for(int i = 1 ; i <= n ; i++) cin>>a[i];
for(int i = 1 ; i <= n ; i++) s+=a[i];
cout<<s<<"\n";
for(int i = 1 ; i <= n ; i++)
if(a[i] > tw) cout<<i<<" ";
}

# data[].attributes.body
//bai 1 :
#include <bits/stdc++.h>

using namespace std;
int a,t;

int main()
{
cout << "nhap so tien phai tra sau moi phut " << endl;
cin>>t;
cout << "nhap so phut da goi " << endl;
cin>>a;
cout<< "so tien nguoi do phai tra la "<<a*t;
return 0;
}
===============================
#include <bits/stdc++.h>

using namespace std;
float x,y,z;
int main()
{
cout << "nhap x , y va z " << endl;
cin>>x>>y>>z;
int sonho=x;
if (sonho > y) sonho=y;
if (sonho >z ) sonho=z;
cout<< "so nho nhat la "<< sonho<<endl;
int tich = x*y;
if (tich < y*z) tich = y*z;
if (tich < x*z) tich = x*z;
cout << "tich hai so lon nhat la " << tich;

return 0;
}
===============================
//Bai 2 :

#include <bits/stdc++.h>

using namespace std;
float x,y,z;
int main()
{
cout << "nhap x , y va z " << endl;
cin>>x>>y>>z;
int sonho=x;
if (sonho > y) sonho=y;
if (sonho >z ) sonho=z;
cout<< "so nho nhat la "<< sonho<<endl;
int tich = x*y;
if (tich < y*z) tich = y*z;
if (tich < x*z) tich = x*z;
cout << "tich hai so lon nhat la " << tich;

return 0;
}
===============================
//Bai 3 :
#include <bits/stdc++.h>
using namespace std ;
bool kt=true;
int main ()

{
int n,i;
cout << "Nhap n ";
cin >> n ;
if(n<2)  kt=false;
else if (n>=2 && n<4) kt = true ;
else
for (i=2;i<=ceil(sqrt(n)); i++)
if(n%i==0)
{
kt=false ;
break;
}
if(kt== true ) cout << n<< " la so nguyen to ";
else
{
i=2;
while (i<=n)
{
if(n%i==0)
{
cout<< i<< "  ";
n=n/i;
}
else i++;
}
}

return 0;
}
===============================
//Bai 4 :
#include<bits/stdc++.h>
using namespace std ;
int n,k,i,solon
;
int a[100000];
int main ()
{
cout << "Nhap n : "; cin >> n;
cout << "Nhap k : "; cin >> k;
for (i=1 ; i<=n ; i++)
{
cout << "nhap phan tu "<<i << "  ";
cin>>a[i];
}

for(i=1;i<=k;i++)
int solon =solon + a[i];
for(i=2;i<=n-k+1;i++)
{
int s=0;
for (int j =i ; j<=k+i-1; j++)
s=s+a[i];
if (s<solon ) solon =s;
}
cout << "tong ba so lon nhat trong mang la "<<s;
return 0;
}

# data[].attributes.body
//bai#include <iostream>

using namespace std;

int main()
{
int a,t;
cout << "nhap a va t " <<endl;
cin>>a>>t;
cout<<"tien thanh toan la :"<<a*t;
return 0;
}
//bai2
#include <iostream>

using namespace std;

int main()
{
int x,y,z;
cout << "nhap x y z" << endl;
cin >>x>>y>>z;
int sonho=x;
if (sonho>y) sonho=y;
if (sonho>z) sonho=z;
cout <<"so nho nhat la"<<sonho<<endl;
int tich=x*y;
if (tich<x*y) tich=x*z;
if (tich<y*z) tich=y*z;
cout <<"tich 2 so lon nhat= "<<tich<<endl;
}
//bai3
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
int i,n;
cout << "nhap n= " << endl;
cin>>n;
bool kt=true;
if (n<2) kt =false;
else if (n>=2 && n<4) kt =true;
else
for (i=2;i<ceil(sqrt(n));i++)
if (n%i==0)
{
kt =false ;
break;
}
if (kt=true) cout <<n<<" la so nguyen to";
else
{
i=2;
while (i<=n)
{
if (n%i==0)
{
cout <<i<<" ";
n=n/i;
}
else i++;
}
return 0;
}
}
//bai4
#include <iostream>

using namespace std;

int main()
{
int n,i,a[i],k;
cout <<" nhap kt mang n = "<<endl;
cin >>n>>k;
for (i=1;i<=n;i++)
{
cout <<"a["<<i<<"]=";
cin>>a[i];
}
for (i=1;i<=n;i++) cout <<a[i]<<" ";
int solon;
cin >>k;
for (i=1;i<=k;i++)
solon=solon+a[i];
for (i=2;i<n-k+1;i++)
{
int j,s=0;
{
for (j=1;j<=k+i-1;j++)
s=s+a[i];
}
if (s>solon) solon=s;
}
return 0;
}

# data[].attributes.body
bai 1
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,t;
cin>>a>>t;
cout<<a*t;
return 0;
}
bai 2
#include <iostream>
using namespace std;
int main()
{
int x, y, z;
cin>>x>>y>>z;
int minl=x;
if(minl>y) minl=y;
if(minl>z) minl=z;
cout<<minl<<endl;
int maxl=x*y;
if(maxl<x*z) maxl=x*z;
if(maxl < z*y) maxl=z*y;
cout <<maxl;
return 0;
}
bai 3
#include <bits/stdc++.h>
using namespace std;

int main()
{
int n;
cout << " Nhap so n :";
cin >> n;
bool kt=true;
if ( n < 2) kt=false;
else if(n>=2) kt= true;
for(int i=2;i<=ceil(sqrt(n));i++)
if(n%i==0)
{
kt=false; break;}
if(kt==true) cout<<"la so nguyen to";
else
{ int i=2;
while(i<=n)
{
if (n%i==0){
cout<<i<<" ";
n=n/i;
} else i++;
}

}
return 0;
}
bai 4
#include <bits/stdc++.h>

using namespace std;
int n,k,a[100001],s=0,sl=0;
int main()
{
cin>>n>>k;
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;i<=n-k+1;i++)
{
s=0;
for(int j=i;j<=i+k-1;j++)
{
s=s+a[j];
}
if(s>sl)
sl=s;
}
cout<<sl;
for (int i = 1; i <= n-1; ++i)
{
for (int j = i + 1;j <= n ; j++)
{
if(a[i] > a[j])
{
int tam = a[i];
a[i] = a[j];
a[j] = tam;}

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

}

cout << "phan tu giua: " << a[(n+1) / 2] ;
return 0;
}

# data[].attributes.body
bai 1:#include<bits/stdc++.h>
using namespace std;
int main()
{
float a, b;
cout <<"hay nhap a va b:";
cin >> a >> b;
cout << "trung binh cong la " << (a+b)/2.0;
}

===============================
bai 2

#include<bits/stdc++.h>
using namespace std;
int main()
{
float a, b, c, d, tong;
cout << "hay nhap diem cac mon toan, van, anh, tin cua ban: ";
cin >> a >> b >> c >> d ;
tong=a+b+c+(d*2);
cout << "tong so diem cua ban la: " << tong;
if (tong >= 30 && a>=5 && b>=5 && c>=5 && d>=5 )
{
cout << " \nban dau";
}
else  cout << "\nve lam ray";

}

===============================
bai 3
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout << " hay nhap n: ";
cin >> n;
for (int i=10;i>=1;--i)
{
cout << n*i << " ";
}
}
===============================bai 4
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int A[1000];
int tong =0;
int t;
cout << "hay nhap so xe di qua cau: " ;
cin >> n;
cout << "hay nhap trong tai cua cau: ";
cin >> t;
for (int i=1; i<=n;++i)
{
cin >> A[i];
}
for (int i =1 ; i<=n ; ++i)
{
tong +=A[i];
}
for ( int i=1; i<=n ;++i)
{
if (A[i] > t )
cout << " cac xe vuot trong tai la " << i ;
}
}

# data[].attributes.body
//Bai1
#include<iostream>

using namespace std;

int main() {
int a, t;
cout << "Nhap so tien phai tra moi phut va so phut goi:" << endl;
cin >> a >> t;
cout << "So tien phai tra: " << a*t;
return 0;
}

//Bai2
#include <iostream>
using namespace std;

int main(){
int x, y, z;
cin >> x >> y >> z;
int m = x;
if (m > y) {
m = y;
if (m > z) m = z;
}
if (m > z) {
m = z;
if (m > y) m = y;
}
cout << "So nho nhat: " << m << endl;
if (x*y > x*z && x*y > y*z) {
cout << "Tich lon nhat: " << x*y;
}
if (x*z > x*y && x*z > y*z) {
cout << "Tich lon nhat: " << x*z;
}
if (y*z > x*y && y*z > x*z) {
cout << "Tich lon nhat: " << y*z;
}
return 0;
}

//Bai3
#include<iostream>
#include<cmath>

using namespace std;

int main() {
int n;
cin >> n;
if (n >= 2) {
for (int i = 2; i <= n-1; i++) {
if (n % i != 0) {
cout << n << " la so nguyen to" << endl;
break;
}
}
}
for (int c = 2; c <= n-1; c++) {
if (n % c == 0) {
for (int j = 2; j <= n - 1;) {
if (n % j == 0) {
n = n/j;
cout << j << " ";
}
if (n % j != 0) {
j++;
cout << j << " ";
}
}
}
}
return 0;
}

//Bai4
#include <iostream>
#include <math.h>

using namespace std;

int main() {
int n, k, a[10000], s=0, sl=0;

cin >> n >> k;

for(int i = 1; i <= n; i++) cin >> a[i];

for(int i = 1; i <= n - k + 1; i++) {
s=0;
for(int j = i; j <= i + k - 1; j++) {
s = s + a[j];
}
if(s > sl) sl = s;
}

cout << sl;
for (int i = 1; i <= n-1; ++i) {
for (int j = i + 1; j <= n; j++) {
if(a[i] > a[j]) {
int tam = a[i];
a[i] = a[j];
a[j] = tam;
}
}
}

for (int i = 1; i <= n; i++ ) {
cout << a[i] << " ";
}
cout << "Phan tu o giua: " << a[(n + 1) / 2] ;

return 0;
}

# data[].attributes.body
//bài 1
#include <bits/stdc++.h>
using namespace std;

int main()
{
float a, b, tbc;
cout << " Nhap a va b :";
cin >> a >> b;
tbc = (a + b )/2;
cout << " Trung binh cong la :" << tbc << endl;
return 0;

}

//bài 2
#include <bits/stdc++.h>
using namespace std;

int main()
{
int t, v, a, th;
float diemtong;
cout << " Nhap diem Toan, Van, Anh va Tin hoc :";
cin >> t >> v >> a >> th;
diemtong = t+v+a+(th)*2;
if ( diemtong >= 30 && t >= 5 && v >= 5 && a >= 5 && th >= 5)
cout << " Diem tong cong la :" << diemtong << "       Ket qua : Dau" << endl;
else
cout << " Diem tong cong la :" << diemtong << "       Ket qua : Hong" << endl;
return 0;
}

//bài 3
#include <bits/stdc++.h>
using namespace std;

int main()
{
int n;
cout << " Nhap n:";
cin >> n;
cout << " Bang cuu chuong cua " << n << " la :";
for ( int i = 10; i >= 1; i--)
{
cout << n * i << " ";
}
return 0;
}

//bài 4
#include <bits/stdc++.h>
using namespace std;

int main()
{
int n, TW, tong = 0, W[1000];
cout << " Nhap n:";
cin >> n;
cout << " TW =";
cin >> TW;
for ( int i = 1; i <= n; i++)
{
cout << " Nhap trong luong xe thu " << i << " :";
cin >> W[i];
}
for ( int i = 1; i <= n; i++)
{
tong = tong + W[i];
}
cout << " tong trong luong cac xe :" << tong << endl;
int dem = 0;
for ( int i = 1; i <= n; i++)
{
if ( TW < W[i])

cout << i;
}
return 0;

}

# data[].attributes.body
//bai 1
#include<bits/stdc++.h>
using namespace std ;
int main()
{
int t,a;
cout << "Nhap a : "; cin >> a ;
cout <<"Nhap t : "; cin >> t ;
cout << "Tien thanh toan : " << a*t ;
}

----------------------------------------------------

//bai2
#include <bits/stdc++.h>
using namespace std;
float x,y,z,sonho,tich;
int main()
{
cout << "Nhap x : "; cin>>x;
cout <<"Nhap y : "; cin >> y;
cout <<"Nhap z : "; cin >> z;
sonho=x;
if(sonho > y ) sonho =y;
if(sonho > z ) sonho=z;
cout << "So nho nhat : " << sonho << endl ;
tich=x*y;
if(tich < x*z ) tich = x*z;
if(tich <y*z) tich = y*z;
cout << "Tich lon nhat : " << tich ;
return 0;
}

--------------------------------------------------------

//bai3
#include <bits/stdc++.h>
using namespace std ;
bool kt=true;
int main ()
{
int n,i;
cout << "Nhap n : "; cin >> n ;
if(n<2) kt=false;
else if(n>=2&&n<4) kt=true;
else for(i=2;i<=ceil(sqrt(n));i++)
if(n%i==0)
{
kt=false;break;
}

if(kt==true) cout << n <<" La so nguyen to ";
else
{
i=2;
while(i<=n)
{
if(n%i==0)
{
cout << i << "  ";
n=n/i;
}
else i++;
}
}
}

------------------------------------------------------

//bai4
#include<bits/stdc++.h>
using namespace std ;
int n,k;
int a[100000];
int main ()
{
cout << "Nhap n : "; cin >> n;
for(int i=1;i<=n;i++)
{
cout << "Phan tu thu a["<<i<<"]=";
cin >> a[i];
}
cout << "Nhap k : "; cin >> k;
int solon=0;
for(int i = 1; i <= k; i++)
solon=solon+a[i];
for(int i = 2 ; i <= n-k+1 ; i++)
{
int s=0;
for(int j=i;j<=k+i-1;j++)
s=s+a[j];
if(s>solon)
solon =s;

}
cout<< endl <<"Tong day con lien tiep lon nhat: "<<solon<<endl;
for (int i=1;i<=n-1;++i)
{
for (int j=i+1;j<=n;j++)
{
if(a[i] > a[j])
{
int q = a[i];
a[i] = a[j];
a[j] = q;
}

}
}
for (int i = 1; i <= n; i++ )
{
cout << a[i] << " ";
}
cout << endl << "phan tu giua: " << a[(n+1) / 2] ;
}

------------------------------------------------------
//bai5
#include<bits/stdc++.h>
using namespace std ;
int main ()
{
int n ,k,i;
cout << "Nhap n : "; cin >> n;
cout << "Nhap k : "; cin >> k;
int a[n];
for( i=1;i<=n;i++)
{
cout << "phan tu thu a["<<i<<"]=";
cin >> a[i];
}
int solon = a[1] ;
for(i=2;i<=n;i++)
if(solon < a[i]) solon=a[i];
int d=1,c=solon,giua;
while(d<=c)
{
giua=(d+c)/2;
int dem=0;
for(i=1;i<=n;i++)
dem+=a[i]/giua;
if(dem==k)
{
cout << "Cac doan go can cat : " << giua << "  " ;
break;
}
if(dem<k) c=giua-1;
else d=giua+1;
}
}

# data[].attributes.body
//bai1

#include<bits/stdc++.h>

using namespace std;

int a,b;

int main ()

{

cout << "Nhap a : ";  cin >>  a ;

cout <<"Nhap b : "; cin >> b ;

cout <<"Trung binh cong : " << float(a+b)/2;

}

-----------------------------------------------------

//bai2

#include<bits/stdc++.h>

using namespace std ;

int t,v,a,tin,d=0;

int main ()

{

cout << "Toan : "; cin >> t ;

cout << "Ngu van : "; cin >> v ;

cout << "Tieng anh : "; cin >> a ;

cout << "Tin hoc : "; cin >> tin ;

d=t+v+a+tin*2 ;

cout <<"Diem tong cong : " << d << endl ;

if(d>=30&&t>=5&&v>=5&&a>=5&&tin>=5)         cout <<"Dau";

else cout << "Hong";

}

---------------------------------------------------------

//bai3

#include<bits/stdc++.h>

using namespace std ;

int n;

int main ()

{

cout << "Nhap n : ";

cin >> n ;

for(int i=10;i>=1;i--)

cout << n*i << "  ";

}

--------------------------------------------------------

//bai4

#include<bits/stdc++.h>

using namespace std ;

int n,tw,s;

int w[10000000];

int main ()

{

cout << "Nhap n : "; cin >> n ;

cout << "Nhap TW : "; cin >> tw;

for(int i=1;i<=n;i++)

{

cout << "Phan tu thu w["<<i<<"]=";

cin >> w[i];

}

cout << "Cac trong luong cua doan xe : ";

for(int i=1;i<=n;i++)

{cout << w[i] << "  " ;}

for(int i=i;i<=n;i++)  s=s+w[i];

cout <<endl << "Tong trong luong: " << s << endl ;

cout <<"Xe co so thu tu vuot muc : ";

for(int i=1;i<=n;i++)

if(w[i] > tw)

cout << i << "  ";

}

# data[].attributes.body
// bai 1
#include<bits/stdc++.h>
using namespace std ;
int main ()
{
int t, a;
cin>>a>>t;
cout<<a*t;
}
// bai 2
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x,y,z;
cin >>x>>y>>z;
int minn=x;
if (minn>y) minn=y;
if (minn>z) minn=z;
cout <<minn;
int t = x * y;
if (t < x * y) t = x * z;
if (t < y * z) t = y * z;
cout <<t;
}
// bai 3
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i;
cout<<"Nhap n: ";
cin>>n;
bool kt = true;
if (n < 2) kt = false;
else if (n >= 2 && n < 4) kt = true;
else
{
for(i = 2; i <= ceil(sqrt(n)); i++)
if(n%1==0)
{
kt = false;
break;
}
}
if(kt == true) cout<<n<<" la so nguyen to";
else
{
i = 2;
while (n <= n)
{
if(n % i == 0)
{
cout<<i<<" ";
n = n/i;
}
else i++;
}
}
}
// bai 4
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, i, k, j, s ;
cin >>n>>k;
int a[n];
for (i = 1 ; i <= n ; i++) cin>>a[i];
int maxx = 0;
for (i = 1 ; i <= k ; i++)
maxx += a[i];
for (i = 2; i <= k ; i++)
{
s = 0;
{
for (j = i ;j <= k+i-1 ; j++)
s = s + a[i];
}
if (s > maxx) maxx = s;
}
cout<<s<<" ";
int tam;
for(int i = 1 ; i <= n ; i++)
for(int j = 1 ; j < n  ; j++)
if(a[i] < a[j]) swap(a[i],a[j]);
cout<<a[(n + 1) / 2];
}

# data[].attributes.body
bai1
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cout<<" nhap a,b";
cin>>a>>b;
cout<<" trung binh cong la: "<<(a+b)/2;
return 0;
}
bai 2
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,tong;
cin>>a>>b>>c>>d;
tong=a+b+c+d*2;
cout<<tong;
if(tong>=30) cout<<"dau";
else cout<<"hong";
return 0;
}
bai 3
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
for (int i=1;i<=10;i++)
cout<<n*i<<"  ";
return 0;
}
bai 4
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, s = 0,tw;
cin>>n>>tw;
int a[n];
for(int i = 1 ; i <= n ; i++)
cin>>a[i];{
for(int i = 1 ; i <= n ; i++)
s+=a[i];
}
cout<<"tong trong luong cua doan xe la: "<<s<<"  "<<endl;
for(int i = 1 ; i <= n ; i++)
{
if(a[i] > tw)
cout<<"xe co so thu tu vuot muc la:"<<i<<" "<<endl;
}
return 0;
}

# data[].attributes.body
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin>>n;
cin>>k;
int a[n];
for(int i = 1 ; i <= n ; i++) cin>>a[i];
int maxx = a[1];
for(int i = 2 ; i <= n ; i++)
if(maxx > a[i]) maxx = a[i];
int d = 1,c = maxx, giua ;
while (d <= c)
{
giua = (d + c) / 2;
int dem = 0;
for(int i = 1 ; i <= n ; i++) dem += a[i] / giua;
if(dem == k)
{
cout<<giua<<" ";
break;
}
if(dem < k) c = giua - 1;
else d = giua + 1;
}
}

# data[].attributes.body
câu 1
#include <iostream>

using namespace std;
int a,t,n;
int main()
{
cout<<"nhap a,t:";
cin>>a>>t;
n=a*t;
cout << "so tien can phai thanh toan la:"<<n<<endl;
return 0;
}
câu 2
#include<iostream>
using namespace std;
int main()
{
float a[3];
for(int i=0;i<3;i++)
{
cout<<" nhap so thu ["<<i+1<<"] : ";
cin>>a[i];

}
float minn=a[0];
for(int i=0;i<3;i++)
{
if(minn>a[i])
minn=a[i];
}
cout<<"gia tri nho nhat: "<<minn;
float maxx=1;

for(int j=1;j<=2;j++)
if(maxx<(a[0]*a[j]))
maxx=(a[0]*a[j]);
cout<<"\ntich lon nhat: "<<maxx;

}
câu 3
#include<bits/stdc++.h>
using namespace std;

int main()
{
int n;
cout<<"nhap n";
cin>>n;
bool a;
if(n<2) a=false;
else if(n>=2&&n<4) a=true;
else
for(int i =2;i<=sqrt(n);i++)
{
if(n%i==0)
{
a=false;
break;
}
else
a=true;
}
if(a==true)
{
cout<<n<<" la so nguyen to";
}
else
{
for(int i=2;i<=n;i++)
{
int dem=0;
for(int j=1;j<=i;j++)
{
if(i%j==0)
dem++;
}
if(dem==2)
{
int dem1=0;
while(n%i==0)
{
dem1++;
n/=i;
}
if(dem1){
cout<<i<<" ";
if(dem1>1)
{
int m=1;
while( m<dem1)
{
cout<<i<<" ";
m++;
}

}
if(n>1)
dem1=0;
}
}
}
}

return 0;
}
câu 4
#include <iostream>
using namespace std;
int main()
{
int k,i,n,a[i];
cout <<" nhap kt mang n = "<<endl;
cin >>n>>k;
for (i=1;i<=n;i++)
{
cout <<"a["<<i<<"]=";
cin>>a[i];
}
for (i=1;i<=n;i++) cout <<a[i]<<" ";
int solon;
cin >>k;
for (i=1;i<=k;i++)
solon=solon+a[i];
for (i=2;i<n-k+1;i++)
{
int j,s=0;
{
for (j=1;j<=k+i-1;j++)
s=s+a[i];
}
if (s>solon);
}
return 0;
}

# data[].attributes.body
//bai1

#include <iostream>
using namespace std;
int a, b, c;
int p, q, r, s, u, v;
int main()
{ cin >> p >> q >> r >> s >> u >> v;
int win=3;
if (p > q) a+=win;
if (q > p) b+= win;
if(q == p) {a++;b++;}
if (r < s) c+= win;
if (r > s) a+=win;
if (r==s){a++; c++;}
if (u > v) b+=win;
if (u < v) c+= win;
if (u == v) {u++; v++;}
cout << "doi A: " << a << endl << "doi B: " << b << endl << "doi C: " << c;
}

===============================

//bai 2

#include <bits/stdc++.h>
using namespace std;
int s;
int main()
{
int n; cin >> n;
for(int i = 1; i <  n ; i++)
s += 1/i;
cout << s+ pow(-1,n+1) * 1/n;
}

===============================

//bai3

#include <bits/stdc++.h>
using namespace std;
int a,b, x, y;
int main()
{
cin >> a >> b;
x=a; y= b;
while(a!=b){
if(a> b) a-= b;
if (b> a) b-= a;
}
cout << x/a << "/" << y/a;

}

===============================

# data[].attributes.body
//BAI 1
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
int p,q,r,s,u,v;
int main ()
{
cout << "nhap p,q,r,s,u,v = "; cin>>p>>q>>r>>s>>u>>v;
if ( p> q) a+=3; else if ( q>p )b+=3 ; else {b+=1;a+=1;}
if (r>s) a+=3; else if (s>r) c+=3; else {a+=1;c+=1;}
if (u>v) b+=3 ; else if (v>u) c+=3; else {b+=1;c+=1;}
cout << "\n diem a = "<<a; cout << "\n diem b = "<<b; cout << "\n diem c = "<<c;
}
//BAI 2
#include <bits/stdc++.h>
using namespace std;
int s=0,n;
int main ()
{
cout << "nhap n = "; cin>>n;
for (int i =1 ; i<= n ; ++i)
s+=1/i;
cout << s+pow(-1,n+1)*1/n;
}
//BAI 3
#include <bits/stdc++.h>
using namespace std;
int a,b,x,y;
int main()
{
cout << "nhap a va b : ";
cin>>a>>b;
x=a;
y=b;
while (a!=b)
{
if (a>b) a-= b;
if (b>a) b-= a;
}
cout << "phan so toi gian la : "<<x/a <<"/"<<y/a;
}