早教吧作业答案频道 -->其他-->
为什么输入10000就不行了,ProblemDescriptionThere'sasequence{An}.An>=0foralln>=0.Andwehavetheequation:An=An*An-An*An-1-2*An-1*An-1-An-1.AndA0=1.Nowyouaregivenanintegern,andyouneedtotellhowmuchisAn%1
题目详情
为什么输入10000就不行了,
Problem Description
There's a sequence { An }.An >= 0 for all n>=0.And we have the equation:An = An*An - An*An-1 - 2 * An-1 * An-1 - An-1.And A0= 1.Now you are given an integer n,and you need to tell how much is An % 100007.
Input
An integer T indicates the number of test cases.T lines followed.Each line contains an integer n.(0
Problem Description
There's a sequence { An }.An >= 0 for all n>=0.And we have the equation:An = An*An - An*An-1 - 2 * An-1 * An-1 - An-1.And A0= 1.Now you are given an integer n,and you need to tell how much is An % 100007.
Input
An integer T indicates the number of test cases.T lines followed.Each line contains an integer n.(0
▼优质解答
答案和解析
1、
#include
using namespace std;
#include
void f(int n)
{
int i,j=0,k,xx[100];
for(i=2;i if(n%i==0)
{
j++;xx[j]=i;
}
xx[0]=1;
xx[j+1]=n;
if(n==0||n<0) cout<<"数据错误!"< else if(n==1) cout<<"这个数非素数!"< else
{
if(j==0)
cout<<"这个数是素数!"< else
{
cout<<"这个数非素数!"< cout<<"它的所有因数依次为:"< for(k=0;k<=j+1;k++)
cout< cout< }
}
}
int main()
{
int n;
cout<<"请输入要检验的整数:"< cin>>n;
f(n);
return 0;
}
2、
#include
#include
using namespace std;
#define N 10000
int f(int n)
{
int i,j=0;
for(i=2;i<=sqrt(n);i++)
if(n%i==0)
j++;
if(n==1) return 0;
else
{
if(j==0)
return 1;
else
return 0;
}
}
int main()
{
int i,sum=0;
for(i=1;i<=N;i++)
if(f(i))
{
sum+=i;
}
cout< return 0;
}
#include
using namespace std;
#include
void f(int n)
{
int i,j=0,k,xx[100];
for(i=2;i
{
j++;xx[j]=i;
}
xx[0]=1;
xx[j+1]=n;
if(n==0||n<0) cout<<"数据错误!"<
{
if(j==0)
cout<<"这个数是素数!"<
{
cout<<"这个数非素数!"<
cout<
}
}
int main()
{
int n;
cout<<"请输入要检验的整数:"<
f(n);
return 0;
}
2、
#include
#include
using namespace std;
#define N 10000
int f(int n)
{
int i,j=0;
for(i=2;i<=sqrt(n);i++)
if(n%i==0)
j++;
if(n==1) return 0;
else
{
if(j==0)
return 1;
else
return 0;
}
}
int main()
{
int i,sum=0;
for(i=1;i<=N;i++)
if(f(i))
{
sum+=i;
}
cout<
}
看了 为什么输入10000就不行了...的网友还看了以下:
社团活动管理信息系统某加工部分的处理模块有模块1输入、姓名,输出、该学生的学号(字符型变量)模块2输 2020-05-24 …
数字转换机输入x→x的2次幂→-3输出→输入→6x→+1输出?若输入x=-1,最终输出结果是什么? 2020-06-05 …
给出下列程序输入→平方→*5→+b→d输出已知当输入的x值为1时,输出的值为1,输入X的值为-2时 2020-06-14 …
入1,输出1/2,输入2,输出2/5,输入3.输出3/10,输入4,输出4/17当输出的数是122 2020-06-15 …
输入1时输出1,输入2时输出3/5,输入3时输出2/5,输入4时输出5/17,输入5时输出3/13 2020-06-15 …
高手来做二元一次方程!1.给出下列程序:输入X→立方→xk→+b→输出,且已知当输入的x的值为1时 2020-07-13 …
若输入的x为1时,输出1若输入的x值为-1,输出值为-3则当输入的x等于0.5时,输出为多少!满意 2020-07-13 …
三变量的判偶逻辑电路为啥列出真值表后输入3个变量均为0输出为什么不是1而是0不是说输入为偶数个1, 2020-07-14 …
给出下列程序:输入x→立方→×k→b→输出且以知当输入的x值为1时:输入值为1;输入的x值为-1时, 2020-12-31 …
给出下列程序:输入x→立方→×k→+b→输出且以知当输入的x值为1时:输入值为1;输入的x值为-1时 2020-12-31 …