VT笊å·ã®å®çŸ©ã
æ°ã®åå²æ³ãäžãããã®
èªç¶æ°nãè² ã§ãªãæŽæ°(x1,x2,x3,,xn)ã§
ïœ1+2*x2+3*x3++n*xn==ïœ
ã®æ¹æ³ãäœåãããã察å¿ããããã®ã«äŒŒãŠããŠ
ãŸãç°ãªã£ãæ§é ãçºçããŠããã®ãé¢çœãã§ãã
玹ä»ããããªã³ã¯ã§å®å
šã«ã¯ç解ããŠããªããšæããŸãã
äŸãã°11æã®è¡šè£ãå
¥ãæ··ãã£ãã«ãŒãã®é
åãã©ããã(2048éãããã)
ããã«ããäžæã®ã«ãŒããè¡šã«ããããè£ã«ãããã¯èªç±ã«éžæã§ã
å§ãã®é
åã«å¯ŸããŠé©åãªå Žæã«ã«ãŒããå·®ã蟌ãã°(èš12æ)ã瀺ãåããã
第äžè
ã«å¿
ãã«ãŒãã®é
åã§1ãã13ã®æ°åã®ã©ãããäŒããããšãã§ããã
äœãäœåŠã«ã«ãŒããè¡šåããè£åãããå³åº§ã«å€æãå·®ã蟌ãã®ã¯ææ©ãèšç®ãšçµéšã
å¿
èŠãšãããã§ãã
ãããã£ãŠå
ã
ã®52æã®æ£èŠã®ãã©ã³ãã§è¡šè£ãå
¥ãæ··ãã£ãã©ã³ãã ãªã«ãŒãã®å Žåã
客ãéžãã ã«ãŒãã®æ°åã¯å©æAããžã§ãŒã«ãŒãããäžæè¿œå ãããç¹ã«ãªãã³ã¹ãã¬ãã
ãããå§ãã®11æã®è¡šè£ã®æ§é ãã¿ãŠãé©åãªäœçœ®ã«å·®ã蟌ãã°å©æBã«äŒããã¯ã§ããŸãã
ãã®ããŒã¯ãŸã§ã¯äŒããããªãã®ã§ã¯ãªãããšæãããŸãã
ããŒã¯ãŸã§åœãŠãããã«ã¯æ£ã«52æã®é
åç¶æ³ãå
šéšäœ¿ããªããšãããªããªãããšãŠãæç®ã«
é Œãããšã¯å°é£ã«ãªãããã§ãã(解決ã®æ¹åæ§ãéã£ãŠããããç¥ããŸããã)
ããŒã¯ãŸã§åœãŠãããæ¹æ³ã
ïŒïœïŒãŸã§ã®æ°åãæã€
ããŒã¯ãD,C,H,S(ãã€ã€,ã¯ã©ã,ããŒã,ã¹ããŒã)ãæã€èš24æã®å Žåã«ã€ããŠ
次ã®å Žé¢ã§ã®è§£èª¬ããé¡ãããŸãã
â 24æã®ã«ãŒããè¡šè£ã°ãã°ãã§é
åãããŠããã
â¡å®¢ã¯ãã®äžã®ä»»æã®ã«ãŒããéžãã§ãåã³ã«ãŒããè£åãã§è¿ãã
(客ã«ããã§ã·ã£ããã«ãããŠãæ§ããªãããããããå¯èœãªãå
¥ããŠäžãããïŒ
â¢ãªãã³ã¹ãã¬ããããã24æã«ããäžæã®ãžã§ãŒã«ãŒ(ãžã§ãŒã«ãŒã«ã¯æããªããŠã
ãéåžžã®ã«ãŒãã§ããããšæããïŒãå©æAããã¡ã
ãé©åãªäœçœ®ã«å
¥ãããã«ãŒãã®é çªãçãã¬ããã«æããã
â£å©æB(â¡,â¢ã®æã¯ãã®å Žã«ããªãã)ãçŸãã25æã®ã«ãŒãã®æã
ããŒãã«ã«ãªãã³ã¹ãã¬ããããã
ãã®é
åç¶æ³ãèŠãŠå®¢ãéžãã ã«ãŒãã®ããŒã¯ãšæ°åãåœãŠãã
ïŒè¿œäŒžïŒ
ããããå®éšããŠã¿ãŠãã£ãšç解ã§ããŸããã
ãã®äŸãè¡ãã«ã¯24æã®ã«ãŒããè£è¡šãåãæ··ããŠãŸãåæã«ã·ã£ããã«ãããŠ
ãªãã³ã¹ãã¬ããããŠã¿ãã
客ã«ã«ãŒããäžæéžã°ããã
ãããã©ãã§ãããã®ã§è£åãã§æ»ããããšãããæŽã«åæã«ã·ã£ããã«ãããŠæ§ããªãã
ïŒæ¬äººãã©ãã«ããã®ãããããªããªãããããå©æAã¯ã«ãŒãã®ååã¯ç¥ã£ãŠãããïŒ
åã³ã«ãŒãããªãã³ã¹ãã¬ããããæãè£åãã«ãŒãã¯1ãè¡šåãã®ã«ãŒãã¯0ã§èªã¿
24åã®0,1ã§äœãããé
åãã§ããã
äŸãšããŠããã
gp > M=vector(24,i,random(2))
%231 = [1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1]
ã§ã©ã³ãã ã«æ§æããŠçœ®ãã
Mã®å
é ã«1ãæ¿å
¥ããŠ
gp > Ma=concat([1],M)
%232 = [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1]
gp > sum(i=1,25,i*Ma[i])%26
%233 = ïŒïŒ
ãš
Mã®æåŸå°Ÿã«0ãæ¿å
¥ããŠ
gp > Mb=concat(M,[0])
%234 = [1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0]
gp > sum(i=1,25,i*Mb[i])%26
%235 = ïŒ
ãèšç®ããŠçœ®ãã
ãããŠ2人ã®å©æA,Bã¯æ°åãšã«ãŒãã®ååã
D;1,2,3,4,5,6ãïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒ
C;1,2,3,4,5,6ãïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒ
H:1,2,3,4,5,6ãïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒ
S:1,2,3,4,5,6ãïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒïŒ
ãšå¯Ÿå¿ãããŠããã
ãã客ã®ã«ãŒããD6ãªããã®ã«ãŒãã®ã³ãŒãã¯ïŒãªã®ã§äžã®ïŒã€ã®æ°ïŒïŒãšïŒã§ã¯ïŒãããè¿ãã®ã§
ã¯ããã®é
åMã«å¯Ÿã0ã®æ°åãå³ç«¯ããå
¥ããŠè¡ããšããç°ãªãé
åãã§ãããã®ãèãããš
MïŒ[1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1] ã«å¯Ÿã
M2ïŒ[1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0]
M3ïŒ[1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1]
M4=[1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1]
M5ïŒ[1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1]
M6=[1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1]
ãšäœãããŠããããã®M6ã
gp > sum(i=1,25,i*M6[i])%26
%237 = 6
ãšç¢ºãã«ã³ãŒãå€ïŒãäœããã
å³ã¡å©æAã¯ããäžæã®ã«ãŒããè¡šåãã«Mã®é
åã®åŸããã9ãš10çªç®ã®éã«æ¿å
¥ããäœæ¥ãããã°ããã
次ã«å®¢ã®ã«ãŒããH5ãªãã³ãŒãæ°ã¯ïŒïŒã§ããã®ã§ïŒïŒã«è¿ããªãã
ããã§1ã®æ°åãMã®é
åã§å·Šç«¯ããå³åŽãžå
¥ããŠè¡ãããšããã£ãŠãããšæ°åãäžã€ãã€å¢å ããã
M=[1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1]
M14=[1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1]
M15=[1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1]
M16=[1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1]
M17=[1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1]
ããã§sum(i=1,25,i*M17[i])%26
%239 = ïŒïŒ
ã埩å
ãããã
泚æç¹ã§0ã1ã®æ°åãããããªããæ§æããŠãããšãããããæ§æããVT(23)ã®ç¬Šå·ããã©ã³ãã®ã³ãŒãå€
ãè¶ããŠããŸãããšããããïŒïŒïŒïŒïŒïŒâ¡0 (mod 26))
ãã®å€ãåœãŠã¯ãŸãé
åã¯é£ã°ãããšã«ãªãã®ã§ãã«ãŒãæ¿å
¥æãããèæ
®ããŠããããšã
ãã®åçã¯ãã©ã³ãæ°ãæ£èŠã®52æã§ãéçšããã®ã§ãè¡šè£æ··åšã®ã«ãŒãã§ã客ã®ã«ãŒãã1ïœ52ã®æ°åã«å¯Ÿå¿ãããŠãã
ãã®é
åã«å¯Ÿãå©æAã¯ãžã§ãŒã«ãŒã䜿ãé©åãªäœçœ®ã«è¡šåã(0)ãè£åã(1)ã®ç¶æ
ã§ã«ãŒããæ¿å
¥ããã°
ãã®ã«ãŒãã®é
åMaãã
sum(i=1,53,i*Ma[i])%54ã§1ïœ52ã®æ°åãå¿
ãäœãåºãããšããã©ããªåæé
åããã§ãå¯èœãšãªãã
æç®ã§ãããã®ä»çµã¿ãåŠçããã«ã¯ç·Žç¿ãç·Žç¿ã§ããã
No.392GAI2022幎11æ13æ¥ 08:40
ãã©ã³ãäžåŒã§ã®ããžãã¯ãã³ã³ãã¥ãŒã¿äžã§åçŸããŠã¿ãŸããã
ã³ãŒãã¯PARI/GPã§ãã
M=vector(52,i,random(2));è¡šè£æ··åšã®ã·ã£ããã«åŸã®èšå®ã§ãã
VT=sum(i=1,52,i*M[i])%54
end=if(VT>52,end=VT-54,VT)
top=(end+vecsum(M)+1)%54
onemax=vecsum(M)
zeromax=52-vecsum(M)
L=List(M)
ïŒå®è¡éšïŒ
M=vector(52,i,random(2))
[0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1,
0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0]
gp > VT=sum(i=1,52,i*M[i])%54
%425 = 3
gp > end=if(VT>52,end=VT-54,VT)
%426 = 3 ----------->Mã®é
åã®æåŸå°Ÿã«0ãè¿œå ãã笊å·é·53ã®VT笊å·ã¯å°äœ3ãæ§æããã
gp > top=(end+vecsum(M)+1)%54
%427 = 28 ------------>Mã®é
åã®æååã«1ãè¿œå ãã笊å·é·53ã®VT笊å·ã¯å°äœ28ãæ§æããã
gp > onemax=vecsum(M)
%428 = 24ã ------------>Mã«å«ãŸãã1ã®åæ°ã
gp > zeromax=52-vecsum(M)
%429 = 28 ------------>Mã«å«ãŸãã0ã®åæ°ã
gp > L=List(M);ã1,0æ°åã®æ¿å
¥ãåé€ãããæãã®ã§ãªã¹ã圢åŒã«ããŸããã
Search0(k)={t=0;}for(i=1,#L,if(L[i]==0,t++;\
if(t==k && t<=52-vecsum(M),print((top+t)%54";"i+1))));ãªã¹ãäžã®0ã®ååšäœçœ®ã®èª¿æ»ã§ãã(è£åãã«ãŒãã®æ¿å
¥äœçœ®ã)
ïŒ-->å³ã®æ°å:Mã®é
åã®äœåŠã«ãžã§ãŒã«ãŒã«ãŒããè£åãã«æ¿å
¥ããããããã
å·Šã®æ°å:å·®ã蟌ãã åŸã®ç¬Šå·é·53ã®VT笊å·ã§ã®å°äœã®å€ïŒ=客ã®éžãã ãã©ã³ãã®ã³ãŒãå€ïŒ
gp > for(k=0,zeromax,Search0(k)
29;2
30;3
31;4
32;6
33;9
34;10
35;12
36;13
37;14
38;15
39;16
40;18
41;21
42;23
43;24
44;25
45;28
46;31
47;34 *
48;36
49;37
50;39
51;40
52;42
53;46
0;49
1;51
2;53 *
*å°ã®ç¢ºèª
gp > listinsert(L,1,34);Vec(L)ã-->1ã®æ°åãLã®34ã®äœçœ®ã«æ¿å
¥ããŸãã
%487 =
[0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1,
0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0]
gp > sum(i=1,53,i*L[i])%54
%488 = 47
ïŒå¿
ãåæç¶æ
ã«æ»ããŠããããšãïŒïŒ
listpop(L,34);ã-->34ã®äœçœ®ã«ããèŠçŽ ãåé€ããŸãã
ãã®åŸæ¬¡ã®äœæ¥
gp > listinsert(L,1,53);Vec(L)
%509 =
[0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1,
0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1]
gp > sum(i=1,53,i*L[i])%54
%510 = 2
listpop(L,53);
-------------------------------------------------------------------------
Search1(k)={t=0;}forstep(i=52,1,-1,if(L[i]==1,t++;\
if(t==k && t<=onemax,print((end+t)%54";"i))))ã;ãªã¹ãäžã®1ã®äœçœ®ã調æ»ããŸãã(è¡šåãã«ãŒãã®æ¿å
¥äœçœ®ãïŒ
ïŒ-->å³ã®æ°å:Mã®é
åã®äœåŠã«ãžã§ãŒã«ãŒã«ãŒããè¡šåãã«æ¿å
¥ããããããã
å·Šã®æ°å:å·®ã蟌ãã åŸã®ç¬Šå·é·53ã®VT笊å·ã§ã®å°äœã®å€
gp > for(k=0,onemax,Search1(k))
4;51
5;49
6;47
7;46
8;44
9;43
10;42
11;40
12;37
13;34
14;32
15;31
16;29
17;28
18;26
19;25
20;21 *
21;19
22;18
23;16
24;10
25;7
26;6 *
27;4
*å°éšåã®ç¢ºèª
gp > listinsert(L,0,21);Vec(L)
%493 =
[0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1,
1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0]
gp > sum(i=1,53,i*L[i])%54
%494 = 20
listpop(L,21);L
gp > listinsert(L,0,6);Vec(L)
%519 =
[0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1,
1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0]
gp > sum(i=1,53,i*L[i])%54
%520 = 26
listpop(L,6);L
èšç®äžãã©ã³ãã«ãªãæ°å53,54(â¡0 ;mod (54))ãåºãŠããæãèµ·ããã®ã§ããããé€å€ããªããèããªããã°
ãªããªããšãããé¢åã§ããã
ããã§ãã¶ããããããåææ¡ä»¶ã§ãäœåŠã«ã«ãŒããè¡šãè£ããå€æããŠæ¿å
¥ããããåãã£ãŠãããšæããŸãã
#èããããªããããªçŸè±¡ãèµ·ãããããã§ããïŒãææ¿ããŸããã
No.394GAI2022幎11æ14æ¥ 21:12