Archive for 五月 11th, 2008

SGU 231 — Prime Sum

Posted on 五月 11th, 2008.

只说一点:如果一个素数p是两个素数a和b的加和,那么a和b一定有且仅有一个为2…正确性显然…
筛法还是蛮快的.
{ SGU 231; Prime Sum - sqybi’s code}//for my winstyprogram sgu231_sqybi;  var    n, i, j, s: longint;    p: array[1..1000000]of boolean;
  begin    readln(n);    fillchar(p, sizeof(p), true);    for i:=2 to n do      if p[i] then        for j:=2 to n div i do          p[i*j] := false;    s := 0;    for i:=2 to n-2 do      if p[i] and […]

Read Full Post | Make a Comment ( 2 so far )

Liked it here?
Why not try sites on the blogroll...