191 条题解
-
0fenghao LV 10 @ 2009-11-04 11:31:07
打表轻松0ms。。
提供下我的超长丑陋打表程序:
function make(n,k:longint):longint;
var i,t,tn,tk:longint;
begin
tk:=2*trunc(ln(n)/ln(10)+1)-k; tn:=n;
while tk>0 do
begin
tn:=tn div 10;
dec(tk);
end;
t:=0;
while tn>0 do
begin
t:=t*10+tn mod 10;
tn:=tn div 10;
end;
tk:=k-trunc(ln(n)/ln(10)+1);
while tk>0 do
begin
n:=n*10;
dec(tk);
end;
inc(n,t);
if palin(n) and check(n) then
begin
if not v[n] then
begin
inc(tot);
a[tot]:=n;
v[n]:=true;
end;
end;
end; -
02009-11-02 09:59:05@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 228ms
├ 测试数据 08:答案正确... 228ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 275ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:731ms#include
int check(int num)
{
int m=0;
for(int n=num;n;n/=10)
m=m*10+n%10;
return m==num;
}
int check2(int a)
{
int i;
int b=1;
for(i=2;i*i-1>m>>n;
if(m%2!=0)
for(i=m;i9989899)break;if(check(i)&&check2(i))cout -
02009-11-01 17:42:14@
传了好多次 注意边界值能取到就好了
var
m,n,i,k,j,l,w:longint;
s,s1,s2,s3:string;
procedure check(a:longint);
beginfor w:=2 to trunc(sqrt(a)) do
if a mod w=0
then exit;
writeln(a);
end;
beginreadln(m,n);
if (m=5)
then writeln('5');
if (m=7)
then writeln('7');
if (m=11)
then writeln('11');for i:=1 to 999 do
for k:=0 to 9 do
begin str(i,s1);
s:=s1;
str(k,s2);
s:=s+s2;
for j:=length(s1) downto 1 do
s:=s+s1[j];
val(s,l);
if l=m then if l mod 2=1 then check(l);
end
else halt;
end;
end. -
02009-10-23 16:30:38@
就是构造。。
#include
#include
int save[10001],fang[100];
int pan(int n)
{
int i;
for(i=2;i -
02009-10-21 12:30:04@
用1-10000去生成回文数
判断素数。
输出即可。注意N>=5。。
注意是用>还是用>= -
02009-10-19 20:09:50@
在usaco全a的程序在这里居然有一个点200错
太诡异了 -
02009-10-19 15:11:38@
终于100了。。。
-
02009-10-18 19:29:28@
先从1..99999找回文数(根据左边生成右边)再判断素数。
错误找出来了,原来是把11这个特殊的数字的位置放错了,Vijos的错误提示也在忽悠人- -。 为了这题,我的通过率降了10%啊啊啊啊啊啊
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 72ms
├ 测试数据 08:答案正确... 41ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 56ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:169ms编译通过...
├ 测试数据 01:答案错误...程序输出比正确答案长
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案错误...程序输出比正确答案长
├ 测试数据 08:答案正确... 103ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案错误...程序输出比正确答案长
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:70 有效耗时:103ms上面都是Sunny的。
下面是Edogawa Conan
编译通过...
├ 测试数据 01:答案错误...程序输出比正确答案长
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案错误...程序输出比正确答案长
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案错误...程序输出比正确答案长
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:70 有效耗时:0ms -
02009-10-17 23:01:01@
bool rev(int i)
{
int t=0,p=i;
while(i)
{
t=t*10+i%10;
i/=10;
}
return t==p? true:false;
}
这是判断回文数的。
我最后一组数他说内存泄露,不知大家能告诉一下我的原因么? #include
#include
bool b[100000001];
int prime[6000000];
int sieve(int n)
{
int i,j;
for(i=2;i*i -
02009-10-12 19:16:32@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
program zifuchuan;
var len,mid,i,j,n,m,k,s,t:longint;w,w1:string;code:integer;jw,bj:boolean;function pd(k:longint):boolean;
begin
if (k=1)or(k=2) then exit(false);
for j:=2 to trunc(sqrt(k)) do if k mod j=0 then exit(false);
exit(true);
end;procedure change1;
begin
if len mod 2=1 then begin if w[mid+1]'9' then begin w[mid+1]:=char(ord(w[mid+1])+1);exit;end
else begin w[mid+1]:='0';jw:=true;end;end;
if mid0 then begin
repeat
if w[mid]'9' then begin w[mid]:=char(ord(w[mid])+1);w[len-mid+1]:=w[mid];exit;end
else begin w[mid]:='0';w[len-mid+1]:='0';end;
dec(mid);
until mid=0; end;
delete(w,1,1);
w:='1'+w+'1';
end;procedure change;
begin
jw:=false;
len:=length(w);
mid:=len div 2;
for i:=1 to mid do begin
if w[i]>w[len-i+1] then jw:=false else jw:=true;
w[len-i+1]:=w[i];
end;
if (mid=0)or(jw=true)then change1;
end;begin
read(n,m);
s:=0;
assign(output,'wokaod.pas');rewrite(output);
if n -
02009-10-09 22:19:14@
区别啊!
vijos sunny
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 25ms
├ 测试数据 04:答案正确... 72ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:运行超时...
├ 测试数据 08:运行超时...
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:运行超时...
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:70 有效耗时:97mspuppy
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 119ms
├ 测试数据 08:答案正确... 88ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 103ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:310ms -
02009-09-25 23:44:21@
{}Program Vijos_P1042;
{} Var i: Word; l, r, t: dWord;
{} Function Z(n: dWord): Boolean;
{} Var i: Word;
{} Begin
{} For i:=2 To Round(Sqrt(n)) Do
{} If n Mod i = 0 Then Exit(False);
{} Z:=True
{} End;
{} Begin
{} Read(l, r);
{} For i:=2 To 9 Do If (i>=l) And (i=l) And (t=r Then Halt;
{} For i:=10 To 99 Do Begin
{} t:=i*10+i Div 10;
{} If (t>=l) And (t=r Then Halt;
{} For i:=10 To 99 Do Begin
{} t:=i*100+i Mod 10 * 10+i Div 10;
{} If (t>=l) And (t=r Then Halt;
{} For i:=100 To 999 Do Begin
{} t:=i*100+i Div 10 Mod 10 * 10+i Div 100;
{} If (t>=l) And (t=r Then Halt;
{} For i:=100 To 999 Do Begin
{} t:=i*1000+i Mod 10 * 100+i Div 10 Mod 10 * 10+i Div 100;
{} If (t>=l) And (t=r Then Halt;
{} For i:=1000 To 9999 Do Begin
{} t:=i*1000+i Div 10 Mod 10 * 100+i Div 100 Mod 10 * 10+i Div 1000;
{} If (t>=l) And (t=r Then Halt;
{} For i:=1000 To 9999 Do Begin
{} t:=i*10000+i Mod 10 * 1000+i Div 10 Mod 10 * 100+i Div 100 Mod 10 * 10+i Div 1000;
{} If (t>=l) And (t -
02009-09-23 21:30:33@
生成回文数 判断素数 AC!
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02009-09-23 21:01:09@
叹气! 又见打表法!
-
02009-09-20 20:48:36@
program ma;
const
bt:array[1..779] of longint=(5,
7,
11,
101,
131,
151,
181,
191,
313,
353,
373,
383,
727,
757,
787,
797,
919,
929,
10301,
10501,
10601,
11311,
11411,
12421,
12721,
12821,
13331,
13831,
13931,
14341,
14741,
15451,
15551,
16061,
16361,
16561,
16661,
17471,
17971,
18181,
18481,
19391,
19891,
19991,
30103,
30203,
30403,
30703,
30803,
31013,
31513,
32323,
32423,
33533,
34543,
34843,
35053,
35153,
35353,
35753,
36263,
36563,
37273,
37573,
38083,
38183,
38783,
39293,
70207,
70507,
70607,
71317,
71917,
72227,
72727,
73037,
73237,
73637,
74047,
74747,
75557,
76367,
76667,
77377,
77477,
77977,
78487,
78787,
78887,
79397,
79697,
79997,
90709,
91019,
93139,
93239,
93739,
94049,
94349,
94649,
94849,
94949,
95959,
96269,
96469,
96769,
97379,
97579,
97879,
98389,
98689,
1003001,
1008001,
1022201,
1028201,
1035301,
1043401,
1055501,
1062601,
1065601,
1074701,
1082801,
1085801,
1092901,
1093901,
1114111,
1117111,
1120211,
1123211,
1126211,
1129211,
1134311,
1145411,
1150511,
1153511,
1160611,
1163611,
1175711,
1177711,
1178711,
1180811,
1183811,
1186811,
1190911,
1193911,
1196911,
1201021,
1208021,
1212121,
1215121,
1218121,
1221221,
1235321,
1242421,
1243421,
1245421,
1250521,
1253521,
1257521,
1262621,
1268621,
1273721,
1276721,
1278721,
1280821,
1281821,
1286821,
1287821,
1300031,
1303031,
1311131,
1317131,
1327231,
1328231,
1333331,
1335331,
1338331,
1343431,
1360631,
1362631,
1363631,
1371731,
1374731,
1390931,
1407041,
1409041,
1411141,
1412141,
1422241,
1437341,
1444441,
1447441,
1452541,
1456541,
1461641,
1463641,
1464641,
1469641,
1486841,
1489841,
1490941,
1496941,
1508051,
1513151,
1520251,
1532351,
1535351,
1542451,
1548451,
1550551,
1551551,
1556551,
1557551,
1565651,
1572751,
1579751,
1580851,
1583851,
1589851,
1594951,
1597951,
1598951,
1600061,
1609061,
1611161,
1616161,
1628261,
1630361,
1633361,
1640461,
1643461,
1646461,
1654561,
1657561,
1658561,
1660661,
1670761,
1684861,
1685861,
1688861,
1695961,
1703071,
1707071,
1712171,
1714171,
1730371,
1734371,
1737371,
1748471,
1755571,
1761671,
1764671,
1777771,
1793971,
1802081,
1805081,
1820281,
1823281,
1824281,
1826281,
1829281,
1831381,
1832381,
1842481,
1851581,
1853581,
1856581,
1865681,
1876781,
1878781,
1879781,
1880881,
1881881,
1883881,
1884881,
1895981,
1903091,
1908091,
1909091,
1917191,
1924291,
1930391,
1936391,
1941491,
1951591,
1952591,
1957591,
1958591,
1963691,
1968691,
1969691,
1970791,
1976791,
1981891,
1982891,
1984891,
1987891,
1988891,
1993991,
1995991,
1998991,
3001003,
3002003,
3007003,
3016103,
3026203,
3064603,
3065603,
3072703,
3073703,
3075703,
3083803,
3089803,
3091903,
3095903,
3103013,
3106013,
3127213,
3135313,
3140413,
3155513,
3158513,
3160613,
3166613,
3181813,
3187813,
3193913,
3196913,
3198913,
3211123,
3212123,
3218123,
3222223,
3223223,
3228223,
3233323,
3236323,
3241423,
3245423,
3252523,
3256523,
3258523,
3260623,
3267623,
3272723,
3283823,
3285823,
3286823,
3288823,
3291923,
3293923,
3304033,
3305033,
3307033,
3310133,
3315133,
3319133,
3321233,
3329233,
3331333,
3337333,
3343433,
3353533,
3362633,
3364633,
3365633,
3368633,
3380833,
3391933,
3392933,
3400043,
3411143,
3417143,
3424243,
3425243,
3427243,
3439343,
3441443,
3443443,
3444443,
3447443,
3449443,
3452543,
3460643,
3466643,
3470743,
3479743,
3485843,
3487843,
3503053,
3515153,
3517153,
3528253,
3541453,
3553553,
3558553,
3563653,
3569653,
3586853,
3589853,
3590953,
3591953,
3594953,
3601063,
3607063,
3618163,
3621263,
3627263,
3635363,
3643463,
3646463,
3670763,
3673763,
3680863,
3689863,
3698963,
3708073,
3709073,
3716173,
3717173,
3721273,
3722273,
3728273,
3732373,
3743473,
3746473,
3762673,
3763673,
3765673,
3768673,
3769673,
3773773,
3774773,
3781873,
3784873,
3792973,
3793973,
3799973,
3804083,
3806083,
3812183,
3814183,
3826283,
3829283,
3836383,
3842483,
3853583,
3858583,
3863683,
3864683,
3867683,
3869683,
3871783,
3878783,
3893983,
3899983,
3913193,
3916193,
3918193,
3924293,
3927293,
3931393,
3938393,
3942493,
3946493,
3948493,
3964693,
3970793,
3983893,
3991993,
3994993,
3997993,
3998993,
7014107,
7035307,
7036307,
7041407,
7046407,
7057507,
7065607,
7069607,
7073707,
7079707,
7082807,
7084807,
7087807,
7093907,
7096907,
7100017,
7114117,
7115117,
7118117,
7129217,
7134317,
7136317,
7141417,
7145417,
7155517,
7156517,
7158517,
7159517,
7177717,
7190917,
7194917,
7215127,
7226227,
7246427,
7249427,
7250527,
7256527,
7257527,
7261627,
7267627,
7276727,
7278727,
7291927,
7300037,
7302037,
7310137,
7314137,
7324237,
7327237,
7347437,
7352537,
7354537,
7362637,
7365637,
7381837,
7388837,
7392937,
7401047,
7403047,
7409047,
7415147,
7434347,
7436347,
7439347,
7452547,
7461647,
7466647,
7472747,
7475747,
7485847,
7486847,
7489847,
7493947,
7507057,
7508057,
7518157,
7519157,
7521257,
7527257,
7540457,
7562657,
7564657,
7576757,
7586857,
7592957,
7594957,
7600067,
7611167,
7619167,
7622267,
7630367,
7632367,
7644467,
7654567,
7662667,
7665667,
7666667,
7668667,
7669667,
7674767,
7681867,
7690967,
7693967,
7696967,
7715177,
7718177,
7722277,
7729277,
7733377,
7742477,
7747477,
7750577,
7758577,
7764677,
7772777,
7774777,
7778777,
7782877,
7783877,
7791977,
7794977,
7807087,
7819187,
7820287,
7821287,
7831387,
7832387,
7838387,
7843487,
7850587,
7856587,
7865687,
7867687,
7868687,
7873787,
7884887,
7891987,
7897987,
7913197,
7916197,
7930397,
7933397,
7935397,
7938397,
7941497,
7943497,
7949497,
7957597,
7958597,
7960697,
7977797,
7984897,
7985897,
7987897,
7996997,
9002009,
9015109,
9024209,
9037309,
9042409,
9043409,
9045409,
9046409,
9049409,
9067609,
9073709,
9076709,
9078709,
9091909,
9095909,
9103019,
9109019,
9110119,
9127219,
9128219,
9136319,
9149419,
9169619,
9173719,
9174719,
9179719,
9185819,
9196919,
9199919,
9200029,
9209029,
9212129,
9217129,
9222229,
9223229,
9230329,
9231329,
9255529,
9269629,
9271729,
9277729,
9280829,
9286829,
9289829,
9318139,
9320239,
9324239,
9329239,
9332339,
9338339,
9351539,
9357539,
9375739,
9384839,
9397939,
9400049,
9414149,
9419149,
9433349,
9439349,
9440449,
9446449,
9451549,
9470749,
9477749,
9492949,
9493949,
9495949,
9504059,
9514159,
9526259,
9529259,
9547459,
9556559,
9558559,
9561659,
9577759,
9583859,
9585859,
9586859,
9601069,
9602069,
9604069,
9610169,
9620269,
9624269,
9626269,
9632369,
9634369,
9645469,
9650569,
9657569,
9670769,
9686869,
9700079,
9709079,
9711179,
9714179,
9724279,
9727279,
9732379,
9733379,
9743479,
9749479,
9752579,
9754579,
9758579,
9762679,
9770779,
9776779,
9779779,
9781879,
9782879,
9787879,
9788879,
9795979,
9801089,
9807089,
9809089,
9817189,
9818189,
9820289,
9822289,
9836389,
9837389,
9845489,
9852589,
9871789,
9888889,
9889889,
9896989,
9902099,
9907099,
9908099,
9916199,
9918199,
9919199,
9921299,
9923299,
9926299,
9927299,
9931399,
9932399,
9935399,
9938399,
9957599,
9965699,
9978799,
9980899,
9981899,
9989899
);
var
//b:array[1..10000000] of boolean;
n,m,i,j:longint;
{function ss(i:longint):boolean;
var
j:longint;
begin
ss:=false;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then
exit;
ss:=true;
end;
function hw(i:longint):boolean;
var
j:longint;
s:string;
begin
str(i,s);
hw:=false;
for j:=1 to length(s) div 2 do
if s[j]s[length(s)-j+1] then
exit;
hw:=true;
end;}
begin
read(n,m);
{for i:=2 to m do
begin
if b[i] then
begin
for j:=2 to m div 2 do
b[j*i]:=false;
end;
end;}
for i:=1 to 779 do
begin
if (bt[i]=n) then
writeln(bt[i]);
end;
end.
猥琐之题,留个纪念…… -
02009-09-19 16:06:50@
打表 ...
-
02009-09-19 14:15:26@
cheat生成器
procedure ss;var i,n:integer; s : string;
begin
assign(input,'d:\123.txt');reset(input);
assign(output,'d:\1.txt');rewrite(output);
writeln('var');
writeln(' a,b : longint;');
writeln('begin');
writeln(' readln(a,b);');
for i := 1 to 779 do
begin
readln(s);
writeln(' if (',s,'>=a) and (',s,' -
02009-10-30 22:16:01@
是不是判断素数耗时太多
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 25ms
├ 测试数据 04:答案正确... 40ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:运行超时...
├ 测试数据 08:运行超时...
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:运行超时...
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:70 有效耗时:65msvar m,n,i:longint;
function huiwen(i:longint):boolean;
var str1:string;
l,j:integer;
begin
huiwen:=false;
str(i,str1);
l:=length(str1);
if l mod 2=0 then begin
for j:=1 to l div 2 do
if ord(str1[j])=ord(str1[l+1-j]) then huiwen:=true
else begin huiwen:=false; exit; end;
end;
if l mod 20 then begin
for j:=1 to (l-1) div 2 do
if ord(str1[j])=ord(str1[l+1-j]) then huiwen:=true
else begin huiwen:=false; exit; end;
end;
if l=1 then huiwen:=true;
end;
function sushu(i:longint):boolean;
var j:longint;
begin
sushu:=true;
for j:=2 to trunc(sqrt(i)) do
if (i mod j=0) and (i2) then begin sushu:=false; exit; end;
if i=1 then sushu:=false;
end;
begin
readln(m,n);
for i:=m to n do
if huiwen(i) then if sushu(i) then writeln(i);
end.
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|-var m,n,i,j,l1,l2,s:longint;
a:array[0..100000] of longint;
str0:string;
function sushu(i:longint):boolean;
var j:longint;
begin
for j:=2 to i do
if j*j>i then exit(true) else
if (i mod j=0) and (i2) then exit(false);
exit(true);
end;
procedure huiwen;
var i,k,p,q,j:longint;
str0,str1:string;
begin
fillchar(a,sizeof(a),0);
for i:=trunc(exp((l1 div 2)*ln(10)))
to trunc(exp((l2 div 2+1)*ln(10))) do
begin
str(i,str0);
str1:='';
for j:=1 to length(str0) do str1:=str1+str0[length(str0)-j+1];
val(concat(str0,str1),q); str1:='';
if (q>=m)and(q=m)and(qa[j] then
begin
a[0]:=a[i];
a[i]:=a[j];
a[j]:=a[0];
end;
for i:=1 to s do
writeln(a[i]);
end.编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms原来判断的时候q有可能等于m,或等于n
结果很奇怪的发现,开大搜索范围,一直都是
编译通过...
├ 测试数据 01:答案错误...程序输出比正确答案长
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:运行超时|无输出...
├ 测试数据 07:答案错误...程序输出比正确答案长
├ 测试数据 08:答案错误... ├ 标准行输出
├ 错误行输出├ 测试数据 09:运行超时|无输出...
├ 测试数据 10:答案错误...程序输出比正确答案长
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:40 有效耗时:0ms
都交了十几次了通过率从47%直跌43%
-
02009-09-17 14:38:19@
var
a, b, count, f, i, l, n : longint;
num : int64;
temp : string;
ans : array[1 .. 30000] of int64;function prime(x : int64) : boolean;
var
i : longint;
begin
if x = 1 then exit(false);
for i := 2 to trunc(sqrt(x)) do
if x mod i = 0 then exit(false);
prime := true;
end;procedure swap(var a, b : int64);
var
temp : int64;
begin
temp := a;
a := b;
b := temp;
end;procedure sort(l, r : longint);
var
i, j, mid : longint;
begin
i := l;
j := r;
mid := ans[(i + j) div 2];
repeat
while ans[i] < mid do inc(i);
while ans[j] > mid do dec(j);
if i j;
if l < j then sort(l, j);
if i < r then sort(i, r);
end;begin
readln(a, b);
n := 0;
str(b, temp);
l := length(temp) div 2;
f := 1;
for i := 1 to l do f := f * 10;
for i := 1 to f - 1 do
begin
num := i div 10;
count := i;
repeat
num := num * 10 + count mod 10;
count := count div 10;
until count = 0;
if (num >= a) and (num = a) and (num = a) and (num 0 then sort(1, n);
for i := 1 to n do writeln(ans[i]);
end. -
02009-09-17 13:11:13@
不打表,不优化,直接过,数据弱:
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msvar
a, b, count, f, i, l, n : longint;
num : int64;
temp : string;
ans : array[1 .. 30000] of int64;function prime(x : int64) : boolean;
var
i : longint;
begin
if x = 1 then exit(false);
for i := 2 to trunc(sqrt(x)) do
if x mod i = 0 then exit(false);
prime := true;
end;procedure swap(var a, b : int64);
var
temp : int64;
begin
temp := a;
a := b;
b := temp;
end;procedure sort(l, r : longint);
var
i, j, mid : longint;
begin
i := l;
j := r;
mid := ans[(i + j) div 2];
repeat
while ans[i] < mid do inc(i);
while ans[j] > mid do dec(j);
if i j;
if l < j then sort(l, j);
if i < r then sort(i, r);
end;begin
readln(a, b);
n := 0;
str(b, temp);
l := length(temp) div 2;
f := 1;
for i := 1 to l do f := f * 10;
for i := 1 to f - 1 do
begin
num := i div 10;
count := i;
repeat
num := num * 10 + count mod 10;
count := count div 10;
until count = 0;
if (num >= a) and (num = a) and (num = a) and (num 0 then sort(1, n);
for i := 1 to n do writeln(ans[i]);
end.