Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M maven7 #155

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 64 additions & 15 deletions SuperPrime-HW2.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <iostream>
#include <vector>
#include<cmath>
class Nature {
private:
int num;
Expand All @@ -16,41 +17,89 @@ class Nature {
~Nature() {
std::cout << "Destroy Nature as " << num << std::endl;
}
void show(){

}
bool isPrime() {
if(num == 1 || num == 0)
return false;
for(int i = 2; i <= (int)sqrt(num); i++)
{
if(num % i == 0)
return false;
}
return true;
}
int compare(const Nature &nat) {
if (num > nat.num)
return 1;
else if(num == nat.num)
return 0;

return -1;
}
private:
};
class SuperPrime {
class SuperPrime : public Nature {
private:
int num;
public:
int max(){

}
SuperPrime(int n,int b) {

}

SuperPrime(int n):num(n) {
}
bool isSuperPrime() {
Nature nat(num);
return nat.isPrime();
}
bool isPrime() {
Nature nat(num);
return nat.isPrime();
}
int compare(const SuperPrime &nat) {
if (num > nat.num)
return 1;
else if(num == nat.num)
return 0;

return -1;
}
};
class Container {
private:
std::vector<Nature> natures;
public:
SuperPrime(int a, int b) {
Container(int a, int b) {
std::cout << "Create SuperPrime from " << a << " to " << b << std::endl;
for(int i = a; i < b; i++) {
Nature nat(i);
SuperPrime nat(i);
std::cout << "HAHA" << std::endl;
natures.push_back(nat);
if(nat.isSuperPrime())
natures.push_back(nat);
std::cout << "DDDDD" << std::endl;
}
}
~SuperPrime() {
std::cout << "Destroy SuperPrime " << std::endl;
}

Nature max() {
std::vector<Nature>::iterate it = natures.begin();
SuperPrime max() {
std::vector<Nature>::iterator it = natures.begin();
Nature max(0);
for(; it != natures.end(); it ++) {
if(it->isSuperPrime()) {
if (max.compare(*it)) {
if (max.compare(*it)) {
max = *it;
}
}
}
}
return max;
return 0;
}
};
int main() {
SuperPrime sp(10, 13);
Nature n = sp.max();
std::cout << "��󳬼�������" ;
std::cout << "・ス・スャシ・ス・ス・ス・ス・ス・ス・ス" ;
n.show();

return 0;
Expand Down
57 changes: 55 additions & 2 deletions SuperPrime_HW.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
#include <iostream>
#include<stdio.h>
#include<math.h>
#include<iostream>

int main(){

int i,n,num=0,max=0;
int jia=0;
for(i=101;i<1000;i=i+2){

int count=0;
char a[5];
n=i;
a[0]=n%10;
a[1]=n/10%10;
a[2]=n/100;


int sum,mul,u;
sum=a[0]+a[1]+a[2];
mul=a[0]*a[2]*a[1];
u=a[0]*a[0]+a[1]*a[1]+a[2]*a[2];

for(int y=2;y<=sqrt(i);y++){
if(i%y==0) count++;
}
for(int y=2;y<=sqrt(sum);y++){
if(sum%y==0) count++;
}

if(mul!=0 && mul!=1){
for(int y=2;y<mul;y++){
if(mul%y==0) count++;
}
}else{
count++;
}

for(int y=2;y<=sqrt(u);y++){
if(u%y==0) count++;
}

if(count==0) {
num++;
jia+=i;
max=i;
}

}

std::cout<<num<<std::endl;
std::cout<<jia<<std::endl;
std::cout<<max<<std::endl;



int main() {
return 0;
}
104 changes: 104 additions & 0 deletions superprime.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#include<iostream>
#include<math.h>

class Nature{
private:
int num;
int a,b,c;
int add,x,sqrtsum;

public:
Nature(int num);
int sum(int a,int b,int c);
int mul(int a,int b,int c);
int sqrts(int a,int b,int c);

};

Nature::Nature(int num){
a=num%10;
b=num/10%10;
c=num/100;
}

Nature::sum(int a,int b,int c){
add=a+b+c;
}

Nature::mul(int a,int b,int c){
x=a*b*c;
}

Nature::sqrts(int a,int b,int c){
sqrtsum=a*a+b*b+c*c;
}


class SuperPrime{
private:
int i;

public:
Nature sp(int i);
SuperPrime(int i,int sum,int mul ,int sqrts);
int max(int i);
int he(int i);
};

SuperPrime::SuperPrime(int i,int sum,int mul ,int sqrts){
int count=0;
for(int h=2;h<sqrt(i);h++){
if(i%h==0){
count++;
}
}

for(int h=2;h<sqrt(sum);h++){
if(sum%h==0){
count++;
}
}

for(int h=2;h<sqrt(mul);h++){
if(mul%h==0){
count++;
}
}

for(int h=2;h<sqrt(sqrts);h++){
if(sqrts%h==0){
count++;
}
}

if(count==0) {
return i;
}
else{
return 0;
}
}

SuperPrime::he(int pd){
int sum=0;
sum+=pd;
}

SuperPrime::max(int pd){
if
}




int main(){

Nature sp(i);
sp.sum;
return 0;
}





55 changes: 55 additions & 0 deletions supers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include<stdio.h>
#include<math.h>

int main(){

int i,n,num=0,max=0;
int jia=0;
for(i=101;i<1000;i=i+2){

int count=0;
char a[5];
n=i;
a[0]=n%10;
a[1]=n/10%10;
a[2]=n/100;


int sum,mul,u;
sum=a[0]+a[1]+a[2];
mul=a[0]*a[2]*a[1];
u=a[0]*a[0]+a[1]*a[1]+a[2]*a[2];

for(int y=2;y<=sqrt(i);y++){
if(i%y==0) count++;
}
for(int y=2;y<=sqrt(sum);y++){
if(sum%y==0) count++;
}

if(mul!=0 && mul!=1){
for(int y=2;y<mul;y++){
if(mul%y==0) count++;
}
}else{
count++;
}

for(int y=2;y<=sqrt(u);y++){
if(u%y==0) count++;
}

if(count==0) {
num++;
jia+=i;
max=i;
}

}

printf("%d\n",num);
printf("%d\n",jia);
printf("%d\n",max);

return 0;
}