曾覃朗 超级素数#1
Open
M-Kylie wants to merge 97 commits into
Open
Conversation
第一次测试
修改中文乱码提示
重构了代码顺序
通过循环方法求平方根
Updated spelling
helloworld add commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#include
int main()
{
int a,b,c;
int k=0,sum=0,max=2;
for(int i=100;i<1000;i++)
{
int f=1;
for(int j=2;j<i;j++)
{
if(i%j!=0)
continue;
else
{
f=-1;
break;
}
}
a=i/100;
b=(i/10)%10;
c=i%10;
for(int j=2;j<a+b+c;j++)
{
if((a+b+c)%j!=0)
continue;
else
{
f=-1;
break;
}
}
if(abc!=0)
{
for(int j=2;j<abc;j++)
{
if((abc)%j!=0)
continue;
else
{
f=-1;
break;
}
}
}
if(abc==0)
f=-1;
for(int j=2;j<aa+bb+cc;j++)
{
if((aa+bb+cc)%j!=0)
continue;
else
{
f=-1;
break;
}
}
if(f==1)
{
k++;
sum+=i;
max=i>max?i:max;
}
}
std::cout<<"超级素数的个数为"<<k<<std::endl;
std::cout<<"所有超级素数之和为" <<sum<<std::endl;
std::cout<<"最大的超级素数为"<<max<<std::endl;
return 0;
}