level 1
老师让我们做一个题目
求n以内孪生素数
这个最大问题在于
我们没有学过函数
定义只学过整型和实型
好人一生平安啊
2015年05月17日 10点05分
1
level 1
如果您会
哥德巴赫猜想也帮我吧
输入一个大于6的数
输出 两个素数a,b
a+b=6
且a大于b
求a,b所有可能
2015年05月17日 10点05分
2
level 4
var a:array[1..1000000] of boolean;
n,i,j,s:longint;
begin
assign(input,'rsss.in');
reset(input);
assign(output,'rsss.out');
rewrite(output);
readln(n);
fillchar(a,sizeof(a),true);
a[1]:=false;
for i:=2 to trunc(sqrt(n)) do
if a[i] then for j:=2 to n div i do
a[i*j]:=false;
s:=0;
for i:=1 to n do
if a[i] then begin
if (a[i+1]) and (i+1<=n) then s:=s+1;
if (a[i+2]) and (i+2<=n) then s:=s+1;
end;
write(s);
close(input);
close(output);
end.
2015年05月20日 13点05分
8
level 7
var
n,i,j,temp:integer;
a:array [0..1229] of integer;
b:array [0..10000] of boolean;
prime:boolean;
begin
read(n);
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),false);
for i:=2 to n do
begin
prime:=true;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then
begin
prime:=false;
break;
end;
if prime then
begin
inc(a[0]);
a[a[0]]:=i;
b[i]:=true;
end;
end;
for i:=2 to n div 2 do
begin
temp:=i*2;
for j:=1 to a[0] do
if temp-a[j]>1 then
if b[temp-a[j]] then
begin
writeln(temp,'=',a[j],'+',temp-a[j]);
break;
end;
end;
end.
2015年05月30日 10点05分
10
哥德巴赫猜想。
2015年05月30日 10点05分
level 1
孪生素数
var n:longint;
i:longint;
procedure prime(n:longint);
var i,j:longint;
a:boolean;
begin
a:=true;
for i:=2 to trunc(sqrt(n)) do
if n mod i=0 then a:=false;
if a then for j:=2 to trunc(sqrt(n+2)) do
if (n+2) mod j=0 then a:=false;
if a then writeln(n,' ',n+2);
end;
begin
readln(n);
for i:=2 to (n-2) do
prime(i);
end.
2015年07月02日 12点07分
12