138 条题解
-
0why001not LV 8 @ 2009-07-23 19:18:50
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
program P151_1;
var
a:array[1..5000] of longint;
len,i,n,sum,w:longint;
s,m:string;procedure yunsuan(l:integer);
var
i,j:longint;
begin
for i:=1 to len do
a[i]:=a[i]*l;
for i:=1 to len-1 do
if a[i]>9999 then
begin
a:=a+a[i] div 10000;
a[i]:=a[i] mod 10000;
end;
j:=len;
while a[j]>9999 do
begin
inc(j);
a[j]:=a[j-1] div 10000;
a[j-1]:=a[j-1] mod 10000;
end;
len:=j;
end;
procedure chuli;
var
i,j:longint;
begin
for i:=1 to len do
begin
str(a[i],m);
s:=s+m;
end;
w:=length(s);
for i:=1 to w do
sum:=sum+ord(s[i])-48;
end;begin
readln(n);
fillchar(a,sizeof(a),0);
a[1]:=1;
len:=1;
for i:=2 to n do
yunsuan(i);
s:=''; sum:=0;
chuli;
for i:=2 to trunc(sqrt(sum)) do
if sum mod i=0 then begin writeln(sum,'F'); halt; end;
writeln(sum,'T');
end. -
02009-07-20 19:17:54@
#include
using namespace std;
int main ()
{
int n,i,j,t=0,d,s[1001]={0};
cin>>n;
s[0]=1;
if (n==1)
{
cout -
02009-07-20 15:49:37@
R1333331 Accepted 100 From H2SO4HCLHNO3-
P1200 FPC Vivid Puppy 2009-7-20 15:44:411333331很吉利啊
-
02009-07-18 10:13:16@
1.高精度;
2.n=2 or n=5时为素数,否则非素数 -
02009-07-17 16:23:54@
老老实实,高精+判断素数
看到别人用逢万进一程序挺短;
不过高精熟练了,打起来根本不用思考!program P1200;
type ay=array[0..1000] of longint;
var a:array[0..1000] of ay;
c:ay;
i,j,n,tot:longint;procedure mutiply(a,b:ay);
var i,j,x,lena,lenb,lenc:longint;
d:ay;
begin
fillchar(d,sizeof(d),0);
lena:=a[0]; lenb:=b[0];
for i:=1 to lena do
begin
x:=0;
for j:=1 to lenb do
begin
d:=a[i]*b[j]+d+x;
x:=d div 10;
d:=d mod 10;
end;
if x0 then d:=d+x;
end;lenc:=lena+lenb;
while (d[lenc]=0) and (lenc>=1) do dec(lenc);
d[0]:=lenc;
for i:=0 to d[0] do
c[i]:=d[i];
end;function check(t:longint):boolean;
var i,j:longint;
begin
check:=true;
for i:=2 to trunc(sqrt(t)) do
if t mod i=0 then exit(false);
end;procedure change(t:longint;var a:ay);
begin
if t -
02009-07-07 15:56:00@
var a,b,e,g,h,l,i,j:longint; c:string; d:array[1..100]of string;
f:array[1..100]of longint; k:char;
function js(n:longint):longint;
var i,j:longint;
begin
j:=1;
for i:=1 to n do
j:=j*i;
js:=j;
end;
begin
read(a);
b:=js(a);
str(b,c);
e:=length(c);
for i:=1 to e do val(c[i],f[i],g);
for i:=1 to e do begin
h:=h+f[i];
end;
for i:=1 to h do begin
if h mod i=0 then begin l:=l+1 end;
end;
if l=0then k:='T'
else k:='F';writeln(h,k);
end.
怎么 会 错了呢? -
02009-06-06 16:06:18@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02009-06-05 20:58:16@
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
太水!!!太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水太水 -
02009-04-11 19:38:12@
var a:array[1..10000]of integer;
n,p,i,j,s:longint;
q:boolean;
begin
readln(n);
p:=1;
a[1]:=1;
for i:=1 to n dobegin
for j:=1 to p do
a[j]:=a[j]*i;
for j:=1 to p do
if a[j]>9 then begin a[j+1]:=a[j+1]+a[j] div 10;a[j]:=a[j] mod 10;end;
if a[p+1]0 then inc(p);
inc(j); while a[j]>9 do
begin
a[j+1]:=a[j+1]+a[j]div 10;
a[j]:=a[j]mod 10;
inc(j);
inc(p);
end;
end;
i:=10000;
while a[i]=0 do dec(i);
for j:=1 to i do
s:=s+a[j];
q:=true;
for i:=2 to trunc(sqrt(s)) do
if s mod i =0 then q:=false;
write(s);
if q then write('T') else write('F');end.
-
02009-02-10 21:32:41@
Type
aa=array[0..300] of longint;
Var
sn,code,i,j,k,n:integer;
b:array[0..10000] of boolean;
a:aa;
str1:string;
Procedure plus(n:integer;var a:aa);
var
i:integer;
begin
for i:=1 to a[0] do a[i]:=a[i]*n;
i:=1;
while (i10000 then
begin
a:=a[i] div 10000 +a;
a[i]:=a[i] mod 10000;
end;
inc(i);
end;
a[0]:=i-1;
end;
Begin
for i:=2 to 10000 do
if not b[i] then
for j:=2 to 10000 div i do
b[j*i]:=true;
sn:=1;
readln(n);
a[1]:=1;
a[0]:=1;
for i:=1 to n do plus(i,a);
for i:=1 to 300 do
k:=k+(a[i] mod 10000) div 1000+(a[i] mod 1000) div 100+(a[i] mod 100) div 10+(a[i] mod 10);
if not b[k] then writeln(k,'T')
else writeln(k,'F');End.
第一次写逢万进一,正好n
-
02009-02-09 23:51:49@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
#include "stdio.h"
int main()
{
int s[10000]={0},i,j,n,t=0,d=0;
scanf("%d",&n);
s[0]=1;
if(n==1)
{
printf("1F");
return 0;
}
else
{
for(i=1;i -
02009-01-21 22:45:54@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
22:43:02..终于过了..经过了1个小时的努力.终于完成..AC12个的说..在回老家之前弄好的一道题.. -
02008-12-10 22:38:55@
这道题不用想得太复杂了,别看N达到一千,其实不到五百,用最笨的办法都可以AC。
program p1200;
var
i,j,n,k,l:longint;
zfc:ansistring;
zz:string;
function gjj(z1,z2:ansistring):ansistring;
var
w1,w2,i,j,k,max:longint;
a,b,c:array[1..10001] of integer;
zfc:ansistring;
begin
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
fillchar(c,sizeof(c),0);
w1:=length(z1); w2:=length(z2);
for i:=1 to w1 do a[w1+1-i]:=ord(z1[i])-48;
for i:=1 to w2 do b[w2+1-i]:=ord(z2[i])-48;
if w1>w2 then max:=w1 else max:=w2;
for i:=1 to max do
begin
c[i]:=c[i]+a[i]+b[i];
if c[i]>9 then
begin
c:=c+1;
c[i]:=c[i] mod 10;
end;
end;
zfc:='';
for k:=max+1 downto 1 do if c[k]0 then break;
for i:=k downto 1 do zfc:=zfc+char(c[i]+48);
gjj:=zfc;
end;
function gjc(z1,z2:ansistring):ansistring;
var
a,b,c,d,e:array[1..10001] of integer;
i,j,k,l,max,w1,w2:longint;
zfc,zz:ansistring;
begin
w1:=length(z1); w2:=length(z2);
for i:=1 to w1 do a[w1+1-i]:=ord(z1[i])-48;
for i:=1 to w2 do b[w2+1-i]:=ord(z2[i])-48;
if w1>w2 then max:=w1 else max:=w2;
zz:='0';
for i:=1 to w2 do
begin
fillchar(c,sizeof(c),0);
for j:=1 to w1 do
begin
c[j]:=c[j]+b[i]*a[j];
if c[j]>9 then
begin
c[j+1]:=c[j+1]+c[j] div 10;
c[j]:=c[j] mod 10;
end;
end;
zfc:='0';
for j:=w1+1 downto 1 do if c[j]0 then break;
for k:=j downto 1 do zfc:=zfc+char(c[k]+48);
for j:=1 to i-1 do zfc:=zfc+'0';
zz:=gjj(zz,zfc);
end;
gjc:=zz;
end;
begin
readln(n);
zfc:='1';
for i:=1 to n do
begin
str(i,zz);
zfc:=gjc(zfc,zz);
end;
k:=0;
for i:=1 to length(zfc) do k:=k+(ord(zfc[i])-48);
write(k);
for i:=1 to k do
if k mod i=0 then l:=l+1;
if l=2 then writeln('T') else writeln('F');
readln
end. -
02008-12-06 16:44:31@
Mr Phone绰号是葱蛋 那疯子
-
02008-12-03 12:07:50@
高精度+判断素数——>AC
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msvar
a:array[0..2600]of longint;
l,r,sum,i,n:longint;
v:boolean;
procedure jiecheng;
var
j:integer;
begin
while a[l]=0 do inc(l);
for j:=l to r do
a[j]:=a[j]*i;
for j:=l to r do
begin
a[j+1]:=a[j+1]+a[j] div 10000;
a[j]:=a[j] mod 10000;
end;
while a[r]=0 do dec(r);
inc(r);
end;begin
read(n);
if n=1 then begin write('1F'); halt; end;
a[1]:=1;
l:=1;
r:=1;
v:=true;
for i:=1 to n do
jiecheng;
for i:=l to r do
sum:=sum+(a[i] mod 10000) div 1000+(a[i] mod 1000) div 100+(a[i] mod 100) div 10+(a[i] mod 10);
for i:=2 to round(sqrt(sum)) do
if sum mod i=0 then
begin
v:=false;
break;
end;
if not v then writeln(sum,'F')
else writeln(sum,'T');
end.Flag Accepted
题号 P1200
类型(?) 其它
通过 1710人
提交 3523次
通过率 49%
难度 1提交 讨论 题解
-
02008-11-29 22:19:06@
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-
02008-11-12 20:55:48@
高精+交表,一次ac!
-
02008-11-12 20:28:29@
program dlgb;
var
z,i,j,n,k,l:longint;
y:int64;
w:real;
bo:boolean;
b:array[0..5000] of longint;
begin
read(n);
b[1]:=1;
k:=1;
for i:=2 to n do begin
w:=0;
for j:=1 to k do begin
b[j]:=b[j]*i+trunc(w);
w:=b[j] div 10;
b[j]:=b[j] mod 10;
end;
b[k+1]:=trunc(w);
j:=k+1;
while b[j]0 do begin
j:=j+1;
b[j]:=b[j-1] div 10;
b[j-1]:=b[j-1] mod 10;
end;
k:=j-1;
end;
j:=5000;
bo:=true;
for z:=1 to k do y:=y+b[z];
write(y);
if (not(odd(y))) and (y2) then begin
bo:=false;
write('F');
end;
z:=1;
while (bo) and (z -
02008-11-08 00:02:42@
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!!
AC30T,热烈庆祝!! -
02008-11-04 10:55:41@
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!
Ac100题,热烈庆祝!!!!!!!!!!!!!!!!!!!