Skip to content

Instantly share code, notes, and snippets.

@dan0nchik
Last active September 17, 2020 07:25
Show Gist options
  • Save dan0nchik/bb78d67372a2d0da0161bfb18e20a896 to your computer and use it in GitHub Desktop.
Save dan0nchik/bb78d67372a2d0da0161bfb18e20a896 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
std::vector<int> v;
for(int i =1390; i<12567;++i ){
if((i%3==0 or i%5==0) and i%7!=0 and i%11!=0 and i%13!=0 and i%23!=0) v.push_back(i);
}
int max = 1389;
for(int i =0;i<v.size();++i){
if(i>max) max=i;
}
cout<<v.size()<<" "<<max;
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int del(int n){
int sum=0;
for(int i = 1; i <n/2;++i){
if(n%i==0) sum+=i;
}
return sum;
}
int main()
{
int n;
cin>>n;
for(int i=0;i<n;++i){
if(i==del(i)) cout<<i<<" ";
}
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int NOD(int a,int b){
while(a!=b){
if(a>b) {
a-=b;
}
else b-=a;
}
return a;
}
int NOK(int a, int b){
return a*b/NOD(a,b);
}
int main()
{
int n,m,k,h;
cin>>n>>m>>k>>h;
cout<<NOK(NOK(n,m),NOK(k,h));
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a,b,c,d,k=0;
cin>>a>>b>>c>>d;
if(a==c or b==d) cout<<"Не проходит";
else{ k = sqrt(pow(a-c,2)+pow(b-d,2));
cout<<k;}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment