الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

المسابقة الاولى للبرمجة المتقدمة بلغة C++ او Java

مغلق
بدأه OpenMindDeveloper في 22 نوفمبر 2003 · 5 رد · 1,691 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

بسم الله الرحمن الرحيم

لقد قرأت اقنراح من بعض الاعضاء بعمل مسابقة برمجيه بلغة C++ او Java ...

انا سأطرح عليكم اول مسأله و الفائز طبعا من يحقق افضل و اسرع و اصغر حل ...

الجوائز : - طبعا يكفيه انه هايكون افضل مبرمج فى الموقع ;-)

المسابقة من 10 مسائل ....

و ستعرض الاسئلة تسلسليا

السؤال الأول :-

TOWERS OF HANOI

Determine when the world will end

The Towers of Hanoi is a classic recursion problem:

N disks, of size N through 1, are stacked in order on the left post of three posts, so the largest disk is on the bottom.

The game is to move the stack of disks from the first post to the third post under the following constraints:

You may only move one disk at a time.

The disks on each post remain sorted from large (bottom) to small (top).

This can be accomplished recursively: to move K disks from post A to post C, first move K-1 disks to the remaining post, B, then move the one remaining disk from post A to post C. Moving the K-1 disks from post B to C is a reduced version of the original problem where the posts have been relabeled.

Legend has it that the Order of the Andes-Chilean Monks, have started the work of moving a 60-disk tower. When they finish, the world will end. Using the above recursive algorithm, this will take 1,152,921,504,606,846,975 moves.

You are to determine, to within a year, when the world will end.

INPUT: data.dat

The input file will contain a sequence of starting times and rates in the format:

YYYY MM DD TMOVE

Here YYYY MM DD is the year, month, and day, using the Gregorian calendar, when the tower game began. TMOVE is the number of seconds it takes to move one disk, and is an integer value in the range 0 < TMOVE < 60. Since the Gregorian calendar system would introduce a significant phase error over this time span, use the following convention:

Use Gregorian calendar conventions to convert the starting date to decimal year.

Use the estimate that there are 365.242199 days in a year to determine the ending date of the world.

Report your result using decimal year notation with one digit of precision after the decimal point.

An example input file would be

line 1:1721 10 19 23[EOL]

2:2001 11 17 59[EOL]

:[EOF]

The output should be in decimal year format, with one digit of precision after the the decimal point. The answer must be correct to with a year.

line 1:Program 0 by team 0[EOL]

2:840297140021.6[EOL]

3:2192079493218.6[EOL]

4:End of program 0 by 0[EOL]

:[EOF]

وأتمنى ان تعجبكم اسئلة المسابقة

وفى انتظار حلولكم

والفئز سيعلن عنه فى كل سؤال يتم حله

اتمنى من المتسابق ان يرفق الحل

−1
#2

السلام عليكم Ahmedvc

و الله انه شكله سؤالك عجيب بس ما اعتقد انه يصلح حق المبتدئين في سي++ اللي بس يعرفون while , for , array و الاشياء الاساسية ..

ليش ما سوي ليهم مسابقة علشان يتحمسون للمادة ... و يحاولون يحلون المسائل بأحسن طريقة ..

اخوك تيمون :)

#3

بسم الله الرحمن الرحيم

أخى الفاضل هذا السؤال ليس صعب

و سوف يكزن مألوف جدا لمن درس Data Structure و AI

فى الفصل الخاص بـ Recursion ....

وهذه مسابقة للبرمجة المتقدمه

قريبا سأضع مسابقة للمبتدئين ..... حبيت ابدأ بالاصعب ....

واود ان اضيف انى اسمح ايضا بالكود المكتوب بلغة C#

حيث انه فى الوقت الحالى بدأ شرح C# بدل من C++ فى جامعة عين شمس و بعض الجامعات ....

واذا لم يتم الاجابة على السؤال ....... سوف اضع الحل مع الشرح

وان شاء الله الاستفادة لنا جميعا ...

#4

انزين نحن حتى ما نعرف شو سالفة Data Structure و AI لانا مبتدئين ...

فاكيد منشوف هذا السؤال صعب حتى لو هو اصلا سهل

تم تعديل هذه المشاركة بواسطة تيمون في 22 نوفمبر 2003 في 23:38

#5

أين المشاركيين ؟؟؟؟؟؟

غدا سأقوم بكتابة الحل

اين التفاعل ....

بهذه الطريقة لن تكمل المسابقة .....

وفى انتظار حلولكم او طلب تمديد الفترة .....

#6

السلام عليكم ,,,

ياأخي Ahmedvc ,, بداية جزاك الله خيرا,,,

ثانيا ياريت مرة أخرى ان تقوم بترجمة الاسئلة الى العربية ,,, مع مراعاة عدم الترجمة الخطية وانما ترجمة لاختصار السؤال الى أقصى حد بحيث يسهل فهمه بسرعة في نفس الوقت ,,,

لكي نستطيع التفاعل أكثر ,,,

banner_60_468.gif

NOTHING IS IMPOSSIBLE

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…