K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

23 tháng 10 2023

#include <bits/stdc++.h>

using namespace std;
long long a[1000006];
long long n;
int main()
{
    for(int i=1;i<=1000006;i++){
        a[i]=i*i;
    }
    cin>>n;
    for(int i=1;i<=n;i++){
        if(a[i]%n==0){cout<<a[i]/n;break;}
    }
    return 0;
}

8 tháng 2 2022

t ko bt lm, ms k10

#include <bits/stdc++.h>
using namespace std;
unsigned long long a[1000],i,n,uc;
//chuongtrinhcon
unsigned long long ucln(long long a,long long b)
{
    if (b==0) return(a);
    else return(ucln(b,a%b));
}
//chuongtrinhchinh
int main()
{
    freopen("sn3.inp","r",stdin);
    freopen("uc.out","w",stdout);
    cin>>n;

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

uc=ucln(a[1],a[2]);

for (i=3; i<=n; i++)

uc=ucln(uc,a[i]);

cout<<uc;
    return 0;
}

 

13 tháng 3 2022

nhờ viết thành pascal hộ nhé

23 tháng 8 2023

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    int a[n];
    for (int i=0;i<n;i++)
        cin >> a[i];
    sort(a,a+n);
    cout << a[k-1];
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int n,kt,t;

int main()

{

cin>>n;

int t=0;

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

if (i%2==1) cout<<i<<" ";

cout<<endl;

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

{

kt=0;

for (int j=2; j*j<=i; j++)

if (i%j==0) kt=1;

if (kt==0) cout<<i<<" ";

}

return 0;

}

26 tháng 11 2019

uses crt;
const fi='standard.inp';
fo='standard.out';
var f1,f2:text;
a:array[1..100]of integer;
i,j,n,dem,t:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
readln(f1,a[i]);
{--------------------xu-ly------------------}
for i:=1 to n do
begin
write(f2,a[i],' co so uoc la: ');
dem:=0;
t:=0;
for j:=1 to a[i] do
if a[i] mod j=0 then
begin
dem:=dem+1;
t:=t+j;
end;
writeln(f2,dem.,' tong uoc la: ',t);
end;
close(f1);
close(f2);
readln;
end.

27 tháng 11 2019

làm như vầy nó chấm sai đó nha

Mình sẽ tạm hiểu đề này là viết chương trình in ra các số nguyên tố lớn hơn hoặc bằng n nha

#include <bits/stdc++.h>

using namespace std;

int n,m,i;

//chuongtrinhcon

bool ktnt(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;

cout<<"Cac so nguyen to nho hon bang n thoa man yeu cau la"<<endl;

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

if (ktnt(i)) cout<<i<<" ";

}