#include<iostream.h>
#include<math.h>
int gcd(int a,int b)
{ int r;
if(a<b)
{ int temp=a;
a=b;
b=temp;}
while(b!=0)
{ r=a%b;
a=b;
b=r;}
return a;}
bool prime(int p)
{ int k=sqrt(p+1);
for(int i=2;i<=k;i++)
if(p%i==0) return false;
return true;}
void main()
{
int i,j,D,p,max,m[3][3];
cout<<"please input the elements of matrix"<<endl;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
cin>>m[i][j];
D=m[0][0]*(m[1][1]*m[2][2]-m[2][1]*m[1][2])-m[0][1]*(m[1][0]*m[2][2]-m[2][0]*m[1][2])
+m[0][2]*(m[1][0]*m[2][1]-m[2][0]*m[1][1]);cout<<D<<endl;
cout<<"the maximum p :";
cin>>max;
for(j=2;j<=max;j++)
{ p=gcd(D,j);
if(prime(j)&&p!=1)
cout<<"p="<<j<<",";
}}
sushu.rar_K.
版权申诉
198 浏览量
2022-09-22
17:05:56
上传
评论
收藏 5KB RAR 举报
邓凌佳
- 粉丝: 65
- 资源: 1万+
最新资源
- nginx配置文件,注意其中需要对应宿主机的路径
- 自用数据集自用数据集自用数据集
- HTML5小游戏【堆雪人-优秀H5小游戏合集】游戏源码分享下载 - epicsnowman.zip
- SNMP Client 是SNMP测试工具
- Android Camera内存统计脚本
- AD9220高速数据芯片硬件参考设计原理图+STM32F103单片机驱动程序代码+芯片技术手册资料.zip
- 常用爆破用户名字典top500
- meta-llama-3-8b-instruct 的 model-00003-of-00004.safetensors 的2/3
- bootstrap-select.js bootstrap-select.css
- EasyPoi Excel和 Word简易工具类
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈