Submission #3457648


Source Code Expand

var
	a,b,c,d,i,n:Longint;
begin
	read(n);
if n<10000 then begin a:=1;b:=0;c:=0;end
else if n<20000 then begin a:=6032;b:=4352;c:=257;end
else if n<30000 then begin a:=8286;b:=8466;c:=6305;end
else if n<40000 then begin a:=2338;b:=4151;c:=5089;end
else if n<50000 then begin a:=8338;b:=8655;c:=3193;end
else if n<60000 then begin a:=8423;b:=2274;c:=7309;end
else if n<70000 then begin a:=2999;b:=5055;c:=7401;end
else if n<80000 then begin a:=8196;b:=7652;c:=1354;end
else if n<90000 then begin a:=9161;b:=4565;c:=6136;end
else if n<100000 then begin a:=5095;b:=6438;c:=5604;end
else if n<110000 then begin a:=7927;b:=2580;c:=936;end
else if n<120000 then begin a:=5133;b:=6540;c:=1726;end
else if n<130000 then begin a:=4332;b:=317;c:=3554;end
else if n<140000 then begin a:=1328;b:=1842;c:=4239;end
else if n<150000 then begin a:=2404;b:=8028;c:=543;end
else if n<160000 then begin a:=604;b:=8788;c:=6591;end
else if n<170000 then begin a:=3062;b:=230;c:=6454;end
else if n<180000 then begin a:=4036;b:=670;c:=4689;end
else if n<190000 then begin a:=8651;b:=9035;c:=3145;end
else if n<200000 then begin a:=1352;b:=4331;c:=7478;end
else if n<210000 then begin a:=8017;b:=1936;c:=2574;end
else if n<220000 then begin a:=6559;b:=5999;c:=6489;end
else if n<230000 then begin a:=7871;b:=1349;c:=5686;end
else if n<240000 then begin a:=2534;b:=9134;c:=7031;end
else if n<250000 then begin a:=4341;b:=7071;c:=4479;end
else if n<260000 then begin a:=78;b:=3019;c:=10005;end
else if n<270000 then begin a:=7317;b:=6076;c:=3605;end
else if n<280000 then begin a:=9447;b:=6200;c:=7825;end
else if n<290000 then begin a:=3784;b:=9975;c:=9578;end
else if n<300000 then begin a:=4371;b:=4220;c:=2629;end
else if n<310000 then begin a:=2023;b:=4296;c:=4559;end
else if n<320000 then begin a:=1276;b:=7245;c:=4348;end
else if n<330000 then begin a:=3188;b:=5380;c:=1254;end
else if n<340000 then begin a:=4469;b:=3367;c:=2299;end
else if n<350000 then begin a:=8186;b:=4387;c:=1925;end
else if n<360000 then begin a:=2955;b:=7678;c:=7471;end
else if n<370000 then begin a:=3726;b:=2451;c:=5356;end
else if n<380000 then begin a:=2695;b:=3121;c:=9004;end
else if n<390000 then begin a:=1312;b:=8645;c:=1301;end
else if n<400000 then begin a:=9935;b:=6843;c:=8144;end
else if n<410000 then begin a:=1413;b:=6430;c:=8524;end
else if n<420000 then begin a:=5325;b:=6629;c:=8468;end
else if n<430000 then begin a:=8128;b:=328;c:=4216;end
else if n<440000 then begin a:=6782;b:=4639;c:=9210;end
else if n<450000 then begin a:=874;b:=7617;c:=3007;end
else if n<460000 then begin a:=5798;b:=2848;c:=1762;end
else if n<470000 then begin a:=7535;b:=708;c:=2622;end
else if n<480000 then begin a:=5060;b:=9500;c:=7220;end
else if n<490000 then begin a:=4746;b:=8959;c:=8666;end
else if n<500000 then begin a:=4458;b:=929;c:=2418;end
else if n<510000 then begin a:=6031;b:=8630;c:=5614;end
else if n<520000 then begin a:=3455;b:=1576;c:=3518;end
else if n<530000 then begin a:=6407;b:=2874;c:=4872;end
else if n<540000 then begin a:=7310;b:=7733;c:=9141;end
else if n<550000 then begin a:=2398;b:=1763;c:=5165;end
else if n<560000 then begin a:=2541;b:=9465;c:=8163;end
else if n<570000 then begin a:=5057;b:=2931;c:=7977;end
else if n<580000 then begin a:=57;b:=5542;c:=2151;end
else if n<590000 then begin a:=9579;b:=8189;c:=2631;end
else if n<600000 then begin a:=1716;b:=9441;c:=3670;end
else if n<610000 then begin a:=488;b:=2107;c:=8993;end
else if n<620000 then begin a:=9593;b:=5662;c:=7277;end
else if n<630000 then begin a:=2180;b:=1495;c:=1972;end
else if n<640000 then begin a:=8966;b:=394;c:=4880;end
else if n<650000 then begin a:=5687;b:=4457;c:=9088;end
else if n<660000 then begin a:=4653;b:=5611;c:=6246;end
else if n<670000 then begin a:=9875;b:=3660;c:=5191;end
else if n<680000 then begin a:=2548;b:=7952;c:=2033;end
else if n<690000 then begin a:=9557;b:=9068;c:=7534;end
else if n<700000 then begin a:=5050;b:=4101;c:=2824;end
else if n<710000 then begin a:=9902;b:=2484;c:=4396;end
else if n<720000 then begin a:=228;b:=8160;c:=8902;end
else if n<730000 then begin a:=6917;b:=1945;c:=1608;end
else if n<740000 then begin a:=8081;b:=7451;c:=3421;end
else if n<750000 then begin a:=7776;b:=9562;c:=398;end
else if n<760000 then begin a:=3909;b:=2048;c:=9626;end
else if n<770000 then begin a:=4952;b:=3778;c:=5158;end
else if n<780000 then begin a:=1396;b:=4020;c:=280;end
else if n<790000 then begin a:=2106;b:=7537;c:=1137;end
else if n<800000 then begin a:=6848;b:=367;c:=4954;end
else if n<810000 then begin a:=1155;b:=2200;c:=7669;end
else if n<820000 then begin a:=1531;b:=1419;c:=8085;end
else if n<830000 then begin a:=3101;b:=9238;c:=1093;end
else if n<840000 then begin a:=2410;b:=7111;c:=7040;end
else if n<850000 then begin a:=4427;b:=7975;c:=848;end
else if n<860000 then begin a:=8124;b:=5086;c:=5266;end
else if n<870000 then begin a:=8695;b:=9419;c:=7698;end
else if n<880000 then begin a:=5993;b:=9658;c:=1975;end
else if n<890000 then begin a:=1833;b:=9037;c:=2984;end
else if n<900000 then begin a:=5581;b:=2555;c:=3684;end
else if n<910000 then begin a:=7195;b:=209;c:=5097;end
else if n<920000 then begin a:=1253;b:=8493;c:=9673;end
else if n<930000 then begin a:=5755;b:=3087;c:=7048;end
else if n<940000 then begin a:=8901;b:=1295;c:=1338;end
else if n<950000 then begin a:=2864;b:=1555;c:=8141;end
else if n<960000 then begin a:=5145;b:=2009;c:=5302;end
else if n<970000 then begin a:=10001;b:=3904;c:=3463;end
else if n<980000 then begin a:=8576;b:=4056;c:=3417;end
else if n<990000 then begin a:=6931;b:=2243;c:=8386;end
else if n<1000000 then begin a:=230;b:=1327;c:=3784;end
else begin a:=2576;b:=1998;c:=8317;end;
n:=n mod 10000;
for i:=1 to n do begin
	d:=(a+b+c)mod 10007;
	a:=b;
	b:=c;
	c:=d;
end;
writeln(a);
end.

Submission Info

Submission Time
Task B - トリボナッチ数列
User kotatsugame
Language Pascal (FPC 2.6.2)
Score 100
Code Size 5854 Byte
Status AC
Exec Time 0 ms
Memory 128 KB

Compile Error

/usr/bin/ld.bfd: warning: ./link.res contains output sections; did you forget -T?

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 36
Set Name Test Cases
All sample_01.txt, sample_02.txt, sample_03.txt, test_1.txt, test_1000000.txt, test_1002.txt, test_104.txt, test_107843.txt, test_10980.txt, test_1212.txt, test_1238.txt, test_13194.txt, test_14.txt, test_16.txt, test_2.txt, test_210782.txt, test_21694.txt, test_243.txt, test_24916.txt, test_278.txt, test_3.txt, test_31.txt, test_32.txt, test_42.txt, test_5555.txt, test_567914.txt, test_61868.txt, test_765671.txt, test_8195.txt, test_8353.txt, test_9.txt, test_9625.txt, test_97.txt, test_998.txt, test_999998.txt, test_999999.txt
Case Name Status Exec Time Memory
sample_01.txt AC 0 ms 128 KB
sample_02.txt AC 0 ms 128 KB
sample_03.txt AC 0 ms 128 KB
test_1.txt AC 0 ms 128 KB
test_1000000.txt AC 0 ms 128 KB
test_1002.txt AC 0 ms 128 KB
test_104.txt AC 0 ms 128 KB
test_107843.txt AC 0 ms 128 KB
test_10980.txt AC 0 ms 128 KB
test_1212.txt AC 0 ms 128 KB
test_1238.txt AC 0 ms 128 KB
test_13194.txt AC 0 ms 128 KB
test_14.txt AC 0 ms 128 KB
test_16.txt AC 0 ms 128 KB
test_2.txt AC 0 ms 128 KB
test_210782.txt AC 0 ms 128 KB
test_21694.txt AC 0 ms 128 KB
test_243.txt AC 0 ms 128 KB
test_24916.txt AC 0 ms 128 KB
test_278.txt AC 0 ms 128 KB
test_3.txt AC 0 ms 128 KB
test_31.txt AC 0 ms 128 KB
test_32.txt AC 0 ms 128 KB
test_42.txt AC 0 ms 128 KB
test_5555.txt AC 0 ms 128 KB
test_567914.txt AC 0 ms 128 KB
test_61868.txt AC 0 ms 128 KB
test_765671.txt AC 0 ms 128 KB
test_8195.txt AC 0 ms 128 KB
test_8353.txt AC 0 ms 128 KB
test_9.txt AC 0 ms 128 KB
test_9625.txt AC 0 ms 128 KB
test_97.txt AC 0 ms 128 KB
test_998.txt AC 0 ms 128 KB
test_999998.txt AC 0 ms 128 KB
test_999999.txt AC 0 ms 128 KB