プログラミングのお題スレ Part22 (863レス)
上下前次1-新
抽出解除 レス栞
160: デフォルトの名無しさん [] 2023/11/26(日)11:41:26.07 ID:1iIVw+fD(1)
>>156
Java
https://paiza.io/projects/NEIRYxOjS1MiyOOhmbhaHA
168: デフォルトの名無しさん [] 2023/11/27(月)18:30:50.07 ID:O6HTjvgJ(1)
>>156
Perl
perl -E 'for ($r = 9999; $n < $r; $_++) { $h{int(rand($r)) + 1} ||= ++$n }; say'
79596
176: デフォルトの名無しさん [sage] 2023/12/04(月)20:26:07.07 ID:LtCaDuZa(1)
>>171 Ruby
def solution1( str )
a = 0
str.chars.inject(''){|s,c|
s << ( (5 & (a = 7 & a << 1 | c.ord & 1) == 5)? '1' : '0' )
}[2..-1] || ''
end
solution( '' ) #=> ""
solution( 'AB' ) #=> ""
223(2): 221 [sage] 2024/02/05(月)20:08:21.07 ID:tt/WRhkt(1/2)
>>206 ruby
https://ideone.com/j2xPyB
・>>221から若干のアレンジ
・SortedSet単位でのみいじるようにした
f = -> a {
g = -> a {a.combination(2) {|x, y| break g.(a.tap {x.merge y; a.delete y}) if x.intersect? y}}
h = a.map {|s| s.split('=')}.flatten.uniq.map.with_index.to_h
a = a.map {|s| s.split('=').map {|k| h[k]}.to_set SortedSet}
g.(a).map {|set| set.map &h.invert.method(:[])}
}
341: デフォルトの名無しさん [] 2024/05/02(木)17:21:22.07 ID:pg1ymc2D(1)
PC買って、脱衣AIで遊びまくってる「
一日一回無料で使えるみたい「
2chスレ:gymnastics
471: デフォルトの名無しさん [] 01/04(土)14:03:19.07 ID:uiECOsgP(1/2)
>>468
ChatGPTロジックだとAABABBが受理されちゃう
550: 警備員[Lv.19] [] 02/09(日)03:18:28.07 ID:Y8d2noVo(1/2)
>>485
Kotlin
https://paiza.io/projects/RtyGxT2PXZScHW6eucI5ng
774: デフォルトの名無しさん [sage] 07/26(土)12:26:55.07 ID:xCVVpUlx(1)
>>772
出題者だけど「各要素の移動先のインデクス」って書いた方がよかったか
文言削りすぎた
815: デフォルトの名無しさん [sage] 08/22(金)06:56:46.07 ID:qlaiAqZd(2/2)
>>814の検証分
fn main() {
assert_eq!(to_nth("123456789"), "1");
assert_eq!(to_nth("123456798"), "2");
assert_eq!(to_nth("123456879"), "3");
assert_eq!(to_nth("416589732"), "123456");
assert_eq!(to_nth("684753219"), "234567");
assert_eq!(to_nth("987654321"), "362880");
assert_eq!(to_nth("111222333444"), "1");
assert_eq!(to_nth("111222334344"), "2");
assert_eq!(to_nth("111222334434"), "3");
assert_eq!(to_nth("222331434114"), "123456");
assert_eq!(to_nth("324424331112"), "234567");
assert_eq!(to_nth("444333222111"), "369600");
assert_eq!(to_nth("111333442545225"), "123456");
assert_eq!(to_nth("555444333222111"), "168168000");
assert_eq!(to_nth("11111222223333344444555556666677777899⑩⑩889889⑩⑩⑩9"), "123456");
assert_eq!(to_nth("⑩⑩⑩⑩⑩999998888877777666665555544444333332222211111"), "49120458506088132224064306071170476903628800");
assert_eq!(to_nth("314159"), "127");
assert_eq!(to_nth("3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067"), "11503448027594046007734790817193859678406683579515952737315863863451534425766911708030454269");
assert_eq!(to_nth("なまむぎなまごめなまたまご"), "10515454");
assert_eq!(to_nth("かえるぴょこぴょこみぴょこぴょこあわせてぴょこぴょこむぴょこぴょこ"), "8273693808428448039784");
}
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 1.505s*