শিরোনামটি বৈধ জেলি কোড যা L€€
দুবার মুদ্রিত ব্যতীত একই আউটপুট রয়েছে ।
পটভূমি
চ্যালেঞ্জটি সম্পন্ন করার ক্ষমতা হারিয়ে আপনি এই বিভাগটি এড়িয়ে যেতে পারেন
জেলির কিছু অপারেশন অপারেশন প্রয়োগের আগে তার যুক্তিটিকে প্রথমে একটি তালিকায় রূপান্তরিত করার চেষ্টা করে। একটি উদাহরণ হ'ল €
দ্রুত ম্যাপিং। এটি কখনও কখনও অনিচ্ছাকৃত আউটপুট বাড়ে।
প্রোগ্রাম L€
এবং ইনপুট 5 এর জন্য, জেলি ইন্টারপ্রেটার 5 তালিকার প্রতিটি উপাদানটির দৈর্ঘ্য সন্ধান করার চেষ্টা করে Since যেহেতু 5 কোনও তালিকা নয়, জেলি এটিকে [1,2,3,4,5] তালিকায় রূপান্তর করে। অতঃপর প্রত্যেকেই উপাদান দৈর্ঘ্য আউটপুট হল: [1,1,1,1,1]
। মনে রাখবেন যে প্রতিটি পূর্ণসংখ্যার দৈর্ঘ্য রয়েছে 1
। উদাহরণস্বরূপ 10
উপস্থিত থাকলে, এটি হয়ে উঠবে 1
, নয় 2
(সংখ্যাগুলির দৈর্ঘ্য)।
প্রোগ্রাম L€€
এবং ইনপুট 5 এর জন্য, জেলি ইন্টারপ্রেটার 5 টি তালিকার প্রতিটি উপাদানের প্রতিটি উপাদানটির দৈর্ঘ্য সন্ধান করার চেষ্টা করে Since যেহেতু 5 কোনও তালিকা নয়, জেলি এটিকে তালিকায় রূপান্তর করে [1,2,3,4,5]
। দোভাষী দের তালিকার প্রতিটি উপাদানের প্রতিটি উপাদানটির দৈর্ঘ্য সন্ধান করার চেষ্টা করেন [1,2,3,4,5]
। প্রতিটি উপাদান একটি তালিকা নন, সুতরাং জেলি একই পদ্ধতিতে তালিকাতে তাদের পরিবর্তন করে: [[1],[1,2],[1,2,3],[1,2,3,4],[1,2,3,4,5]]
। প্রতিটি উপ-উপাদান দৈর্ঘ্য হিসাবে আউটপুট হয়[[1],[1,1],[1,1,1],[1,1,1,1],[1,1,1,1,1]]
কার্য
আপনার কাজটি হ'ল জেলি প্রোগ্রামটির আউটপুট এবং L
তারপরে €
বারবার a
, ইনপুট সহ b
, যেখানে a
এবং b
আপনার প্রোগ্রাম / ফাংশনের ইনপুটগুলির সমান ইতিবাচক পূর্ণসংখ্যার সন্ধান করা।
এটি করার একটি উপায়:
ইনপুট দিয়ে শুরু করে b
, নিম্নলিখিত a
সময়গুলি করুন:
- প্রোগ্রামটি দেখায় এমন প্রতিটি পূর্ণসংখ্যার জন্য, এটি পূর্ণসংখ্যার পরিসর (যেখানে
range(x) := [1,2,3,...,x-1,x]
) এর সাথে প্রতিস্থাপন করুন
অবশেষে, প্রতিটি পূর্ণসংখ্যা 1 দিয়ে প্রতিস্থাপন করুন।
পরীক্ষার কেস
a
b
output
- - - - -
1
1
[1]
- - - - -
1
2
[1, 1]
- - - - -
1
3
[1, 1, 1]
- - - - -
1
4
[1, 1, 1, 1]
- - - - -
1
5
[1, 1, 1, 1, 1]
- - - - -
1
6
[1, 1, 1, 1, 1, 1]
- - - - -
2
1
[[1]]
- - - - -
2
2
[[1], [1, 1]]
- - - - -
2
3
[[1], [1, 1], [1, 1, 1]]
- - - - -
2
4
[[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]
- - - - -
2
5
[[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]
- - - - -
2
6
[[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]
- - - - -
3
1
[[[1]]]
- - - - -
3
2
[[[1]], [[1], [1, 1]]]
- - - - -
3
3
[[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]
- - - - -
3
4
[[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]
- - - - -
3
5
[[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]]
- - - - -
3
6
[[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]]
- - - - -
4
1
[[[[1]]]]
- - - - -
4
2
[[[[1]]], [[[1]], [[1], [1, 1]]]]
- - - - -
4
3
[[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]]
- - - - -
4
4
[[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]]
- - - - -
4
5
[[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]]]
- - - - -
4
6
[[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]]]
- - - - -
5
1
[[[[[1]]]]]
- - - - -
5
2
[[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]]]
- - - - -
5
3
[[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]]]
- - - - -
5
4
[[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]]]
- - - - -
5
5
[[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]]]]
- - - - -
5
6
[[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]]]]
- - - - -
6
1
[[[[[[1]]]]]]
- - - - -
6
2
[[[[[[1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]]]]
- - - - -
6
3
[[[[[[1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]]]]
- - - - -
6
4
[[[[[[1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]]]]
- - - - -
6
5
[[[[[[1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]]]]]
- - - - -
6
6
[[[[[[1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]]]], [[[[[1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]]], [[[[1]]], [[[1]], [[1], [1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]]], [[[1]], [[1], [1, 1]], [[1], [1, 1], [1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1]], [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]]]]]
বিধি
a
এবংb
ইতিবাচক পূর্ণসংখ্যার মধ্যে সীমাবদ্ধ- তোমার প্রোগ্রাম বা ফাংশন লাগতে পারে
a
এবংb
কোনো অনুক্রমে এবং কোন স্ট্যান্ডার্ড ইনপুট ফরম্যাটে - আউটপুটটি গভীরতার-তালিকা বা এই জাতীয় তালিকার স্ট্রিং প্রতিনিধিত্ব হওয়া উচিত
- আউটপুটটি কোনও মানক আউটপুট ফর্ম্যাটের মাধ্যমে ফেরত দেওয়া উচিত।
- এটি কোড-গল্ফ , তাই প্রতিটি ভাষার মধ্যে সংক্ষিপ্ততম কোডটি জয়ী!
1
দৈর্ঘ্য তার দশমিক প্রসারের দৈর্ঘ্য নয়?
L€€CH!DṬHỊṢṄ!
(বা সম্ভবত L€€Ṅ
) বিটিডব্লিউতে গল্ফ করা যেতে পারে ...