توضيحات : // ID: your Student ID مثال: // ID: o o

Similar documents
A Comparative study on organizational positions of health management and information technology department of hospitals and proposing a model for Iran

ﺎﺘ ﻨ ﻤ ھ تﺎ ر ﻦ ﻓ MCSE 2003: Course Group Course name Exam # Duration(hrs) Salary(Rials) Network+:

CONFIGURING CLIENT ACCESS SERVERS

Grammar Book to Accompany Units 1-8

Important safeguards:

Introduction to Fractions and Mixed Numbers

Times Table Activities: Multiplication

1 GETTING STARTED. 5/7/2008 Chapter 1

The ad hoc reporting feature provides a user the ability to generate reports on many of the data items contained in the categories.

Your Outlook Mailbox can be accessed from any PC that is connected to the Internet.

990 e-postcard FAQ. Is there a charge to file form 990-N (e-postcard)? No, the e-postcard system is completely free.

Access EEC s Web Applications... 2 View Messages from EEC... 3 Sign In as a Returning User... 3

1) Update the AccuBuild Program to the latest version Version or later.

Excel Contact Reports

Getting Your Fingers In On the Action

On the Evaluation of Master of Arts Program in Teaching English as a Foreign Language (TEFL) at Ilam University

BASIC RULES OF CHESS

WINDOW REPLACEMENT Survey

learndirect Test Information Guide The National Test in Adult Numeracy

جلس حض ری ورا با WorkShop رسیذ.ایي د ر ب د بخص 10 جلس ای تقسین ب ذی گردیذ.بخص ا ل ضاهل را ا ذازی سایت ساخت لیست Infopad ارتباط با SharePoint ب د

Otomasyon, Danışmanlık Ltd. Şti. INDILOAD DATACARD M AN UAL. Antetli03.doc / Page 9 of 1. Kibele Hedef mükemmele ulasmaksa.

Coordinates. Definition of terms

Front: English AP 1500 NU

GED MATH STUDY GUIDE. Last revision July 15, 2011

efusion Table of Contents

STIDistrict SQL Database Backup and Restore

Server 2008 R2 - Generic - Case

Connecticut State Department of Education School Health Services Information Survey

Gain vs. Proportional Band

From Beginner To Winner

401(k) Savings Plan Annual Incentive Compensation Election Special Considerations for Deferred Compensation Plan Participants

OUTLOOK All About Archives

Personal Selling. Lesson Objectives Meaning of Personal Selling

Lesson Dimensional Solids. Objectives. Classify 3-Dimensional solids Determine the Volume of 3-Dimensional solids. Student Name: Date:

Creating Vehicle Requests

Hardware components. Typical connections and data flow. Student 3 page 1: Low Merit

Fixed vs. Variable Interest Rates

CSAT Account Management

CSE 231 Fall 2015 Computer Project #4

Ad Hoc Reporting: Query Building Tyler SIS Version 10.5

TaskCentre v4.5 File Transfer (FTP) Tool White Paper

How To Install Fcus Service Management Software On A Pc Or Macbook

ELEC 204 Digital System Design LABORATORY MANUAL

Exchanging Files Securely with Gerstco Using gpg4win Public Key Encryption

Writing a Compare/Contrast Essay

Exercise 5 Server Configuration, Web and FTP Instructions and preparatory questions Administration of Computer Systems, Fall 2008

Exercise 5 Server Configuration, Web and FTP Instructions and preparatory questions Administration of Computer Systems, Fall 2008

Derivative Markets and Instruments

Software and Hardware Change Management Policy for CDes Computer Labs

GETTING STARTED With the Control Panel Table of Contents

Backward Design Lesson Planning. How do I determine and write lesson objectives? (identifying desired results)

Experiment 1: Freezing Point Depression

Title: How Do You Handle Exchange Mailboxes for Employees Who Are No Longer With the Company

ATL: Atlas Transformation Language. ATL Installation Guide

Chapter - 3. Cable Connections

Pokémon Organized Play Official Tournament Formats

Semester Exam Review Answers. 3. Construct a perpendicular at point B, then bisect the right angle that is formed. 45 o

POKER LOTTO LOTTERY GAME CONDITIONS These Game Conditions apply, until amended or revised, to the POKER LOTTO lottery game.

THE EMPLOYMENT LAW DISPUTE SPECIALISTS DAMAGES BASED AGREEMENT. Your Employment Tribunal claim relating to your employment with...

Barracuda API 3.0 Firmware Barracuda Spam Firewall

Table of Contents. Welcome to Employee Self Service... 3 Who Do I Call For Help?... 3

Regions File Transmission

Licensing Windows Server 2012 for use with virtualization technologies

TRAINING GUIDE. Crystal Reports for Work

FINRA Regulation Filing Application Batch Submissions

Succession Planning & Leadership Development: Your Utility s Bridge to the Future

معرفی چند منبع در زمینه آموزش برنامه نویسی MATLAB یا متلب

David Drivers Revit One-sheets: Linked Project Positioning and shared coordinates

Using Sentry-go Enterprise/ASPX for Sentry-go Quick & Plus! monitors

Note: The designation of a Roommate is determined from the Occupants table. Roommate checkbox must be checked.

Spread Bet Terms: Deposit Accounts

Hartford Seminary s. Online Application Instructions

BRILL s Editorial Manager (EM) Manual for Authors Table of Contents

CFD and Spot Forex Terms: Deposit Accounts

Steps to fix the product is not properly fixed issue for international clients.

Emulated Single-Sign-On in LISTSERV Rev: 15 Jan 2010

How much life insurance do I need? Wrong question!

TaskCentre v4.5 File Management Tool White Paper

A COMPLETE GUIDE TO ORACLE BI DISCOVERER END USER LAYER (EUL)

CREDIT REPORTING USER GUIDE

Licensing Windows Server 2012 R2 for use with virtualization technologies

Oracle Social Engagement & Monitoring Professional Services Descriptions. July 23, 2015

Space Exploration Classroom Activity

Competitive Intelligence Report - Market Snapshot Explanations of Numbers Suggestions and Tips

ENTRY STANDARDS. Approved by IAAF Council - March 2012 and November 2012

DFRobot Romeo All-in-one Microcontroller (ATMega 328) Product code : RB-Dfr-36. Manual. o o. o o o. o 6.2 Example use of Button 1-5. o o o o.

Honors Geometry A. Semester Exam Review Answers

Spread Bet Terms: Deposit Accounts

FOCUS Service Management Software Version 8.5 for Passport Business Solutions Installation Instructions

Transcription:

به نام خدا دانشگاه صنعتی شريف دانشکده مهندسی کامپيوتر درس مبانی برنامهسازی پيک شادی (تمرين سری دوم) سال نو مبارک

توضيحات : قبل از شروع موارد زير را به دقت بخوانيد. در خط اول هر يک از برنامهها شماره دانشجويی خود را به فرمت زير بنويسيد: // ID: yur Student ID مثال: // ID: 8765432 بعد از نوشتن همه برنامهها همه ا نها را در يک فولدر با نام assignment#2_stdid قرار دهيد( که در ا ن stdid شماره دانشجويی شما می باشد.) مثلا : assignment#2_8765432 و سپس اين فولدر را فشرده کنيد. فايل فشرده شده را به ا درس cpphmewrk852@gmail.cm ارسال نماييد. stdid عنوان ايميل بايد به صورت assignment#2_stdid دانشجويی شما می باشد. باشد که در ا ن شماره اشتباه در نامگذاری فايل برنامهها و فايل فشرده شده و يا عنوان ايميل فرستاده شده موجب عدم تصحيح تمرين شما میشود. فرمت ورودی و خروجی برنامههای شما بايد دقيقا به صورت گفته شده در مسي له باشد در غير اين صورت چون برنامههای شما به صورت خودکار تصحيح می شود خروجی برنامهی شما با خروجی برنامهی مصحح منطبق نخواهد بود. به هر يک از برنامههای شما تعدادی تست داده خواهد شد. تستهای نمونه را به برنامههای تان بدهيد. توصيه می شود که حتما يک بار به برنامههای مشابه به ميزان نمره سوال نمره منفی تعلق خواهد گرفت. موفق باشيد. برای اين کار کافی است روی فولدر کليک راست کنيد و از منوی باز شده Send t و سپس (Zipped) Cmpressed Flder را انتخاب کنيد. با اين کار يک فايل به نام assignment#_stdid.zip ساخته می شود. 2

مسي له اول ------------------------------------------------------------ نام فايل برنامه : BigNumber.cpp در اين مسي له شما بايد دو عدد را از ورودی بخوانيد و بتوانيد سه عمليات زير را روی ا نها انجام دهيد : i. دو عدد را با هم جمع کنيد..ii دو عدد را در هم ضرب کنيد..iii عدد اول را به توان عدد دوم برسانيد. و نتيجه را در خروجی چاپ کنيد. به همين راحتی!!! توجه داشته باشيد که جواب ها ) و يا حتی ورودی ها ( می توانند تا 000 رقم داشته باشند.( يعنی خيلی بزرگ هستند.) راهنمايی : انواع عددی استاندارد در C حداکثر اعداد تا 60 رقم را پشتيبانی می کنند. بنابراين نمی توانيد از انواع عددی C استفاده کنيد و بايد فکر ديگری بکنيد. راهنمايی 2: برای جمع کردن می توانيد ورودی ها را به صورت ا رايه ای از کاراکترها بگيريد و وظيفه خطير جمع کردن را خود به عهده بگيريد! راهنمايی 3: اگر جمع را به صورت تابع بنويسيد پياده سازی ضرب و توان به ا سانی انجام پذير است. قالب ورودی و خروجی ها : ورودی را به صورت استاندارد ) از صفحه کليد ( بخوانيد. در خط اول n تعداد پرسش ها از برنامه شما می ا يد. در n خط بعدی در هر خط می تواند يکی از قالب های زير بيايد : ADD num num2 در اين حالت اعداد num و num2 را با هم جمع می کنيد. MUL num num2 در اين حالت اعداد num و num2 را در هم ضرب می کنيد. POW num num2 در اين حالت عدد num را به توان عدد num2 می رسانيد. در هر سه حالت جواب را در يک خط در خروجی استاندارد چاپ می کنيد. تذکر : دقت کنيد که همه حروف MUL ADD و POW بزرگ است. نمونه ورودی و خروجی ها را در زير مشاهده می کنيد : 4 ADD 9999999999 2 MUL 00 23456789 POW 2 00 ADD 20-00 خروجی نمونه : 000000000 2345678900 26765060022822940496703205376-80 ورودی نمونه : int64 و... مثل lngint int 3

و 8 و 5 و 8 مسي له دوم ------------------------------------------------------------ نام فايل برنامه : Interval.cpp در اين مسا له شما بايد پس از دريافت حدود 5 بازه از ورودی اجتماع ا نها را بيابيد و در خروجی چاپ کنيد. توجه کنيد که بايد حتیالامکان حدود کمتری را برای بازهها ذکر کنيد. مثلا مجموع دو بازهی ) ) و ) 3) را به صورت ) ) در نظر بگيريد. قالب ورودی و خروجی ها : ورودی را در 5 خط و در هر خط 2 عدد بخوانيد. هر خط نشانهی يک بازه است. عدد اول هر خط نشانهی حد سمت چپ و عدد دوم نشانهی حد سمت راست بازهاند. خروجی میتواند شامل چندين بازه شود. لذا در خط اول ا ن تعداد بازهها (n) را بنويسيد و سپس در هر يک از n سطر بعد حدود يکی از بازهها را بنويسيد. توجه داشته باشيد که بايد بازهها را به ترتيب صعودی بنويسيد. - 4 4 9-6 2 2 2-30 -20 خروجی نمونه : ورودی نمونه : 3-30 -20-6 9 2 2 مسي له سوم ------------------------------------------------------------ نام فايل برنامه Check.cpp: Yur task is t write a prgram that reads a chessbard cnfiguratin and identifies whether a king is under attack (in check). A king is in check if it is n square which can be taken by the ppnent n his next mve. White pieces will be represented by uppercase letters, and black pieces by lwercase letters. The white side will always be n the bttm f the bard, with the black side always n the tp. Fr thse unfamiliar with chess, here are the mvements f each piece: Pawn (p r P): can nly mve straight ahead, ne square at a time. Hwever, it takes pieces diagnally, and that is what cncerns yu in this prblem. Knight (n r N): has an L-shaped mvement shwn belw. It is the nly piece that can jump ver ther pieces. Bishp (b r B): can mve any number f squares diagnally, either frward r backward. Rk (r r R): can mve any number f squares vertically r hrizntally, either frward r backward. Queen (q r Q): can mve any number f squares in any directin (diagnally, hrizntally, r vertically) either frward r backward. King (k r K): can mve ne square at a time in any directin (diagnally, hrizntally, r vertically) either frward r backward. Mvement examples are shwn belw, where * indicates the psitins where the piece can capture anther piece: 4

Pawn Rk Bishp Queen King Knight......*......*...*...*............*... *...*. *..*..*.............*....*...*...*.*.*.......*.*.........*.....*.*.....***.....***....*...*.....p... ***r****...b... ***q****..*k*......n.....*.*......*.....*.*.....***.....***....*...*........*....*...*...*.*.*.......*.*.........*... *...*. *..*..*....... Remember that the knight is the nly piece that can jump ver ther pieces. The pawn mvement will depend n its side. If it is a black pawn, it can nly mve ne square diagnally dwn the bard. If it is a white pawn, it can nly mve ne square diagnally up the bard. The example abve is a black pawn, described by a lwercase p. We use mve t indicate the squares where the pawn can capture anther piece. Input There is a bard cnfiguratin in the input, cnsisting f eight lines f eight characters. A. dentes an empty square, while upper and lwercase letters represent the pieces as defined abve. There will be n invalid characters and n cnfiguratins where bth kings are in check. The bard will cntain exactly ne white king and ne black king. Output Yu must utput ne f the fllwing answers: white king is in check. black king is in check. n king is in check. Sample input..k... ppp.pppp....r...b........ PPPPPPPP K... Sample Output black king is in check. rnbqk.nr ppp..ppp...p......p....bpp......n.. PP..PPPP RNBQKB.R white king is in check. 5

مسي له چهارم -------------------------------------------------------- ---- نام فايل برنامه Jlly.cpp: A sequence f n > 0 integers is called a jlly jumper if the abslute values f the differences between successive elements take n all pssible values thrugh n. Fr instance, 4 2 3 is a jlly jumper, because the abslute differences are 3, 2, and, respectively. The definitin implies that any sequence f a single integer is a jlly jumper. Write a prgram t determine whether each f a number f sequences is a jlly jumper. Input Each line f input cntains an integer n < 3, 000 fllwed by n integers representing the sequence. Output Fr each line f input generate a line f utput saying Jlly r Nt jlly. Sample input 4 4 2 3 5 4 2-6 Sample Output Jlly Nt jlly مسي له پنجم ------------------------------------------------------------ نام فايل برنامه Pker.cpp: A pker deck cntains 52 cards. Each card has a suit f either clubs, diamnds, hearts, r spades (dented C, D, H, and S in the input data). Each card als has a value f either 2 thrugh 0, jack, queen, king, r ace (dented 2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, A). Fr scring purpses card values are rdered as abve, with 2 having the lwest and ace the highest value. The suit has n impact n value. A pker hand cnsists f five cards dealt frm the deck. Pker hands are ranked by the fllwing partial rder frm lwest t highest. High Card. Hands which d nt fit any higher categry are ranked by the value f their highest card. If the highest cards have the same value, the hands are ranked by the next highest, and s n. Pair. Tw f the five cards in the hand have the same value. Hands which bth cntain a pair are ranked by the value f the cards frming the pair. If these values are the same, the hands are ranked by the values f the cards nt frming the pair, in decreasing rder. Tw Pairs. The hand cntains tw different pairs. Hands which bth cntain tw pairs are ranked by the value f their highest pair. Hands with the same highest pair are ranked by the value f their ther pair. If these values are the same the hands are ranked by the value f the remaining card. Three f a Kind. Three f the cards in the hand have the same value. Hands which bth cntain three f a kind are ranked by the value f the three cards. Straight. Hand cntains five cards with cnsecutive values. Hands which bth cntain a straight are ranked by their highest card. 6

Flush. Hand cntains five cards f the same suit. Hands which are bth flushes are ranked using the rules fr High Card. Full Huse. Three cards f the same value, with the remaining tw cards frming a pair. Ranked by the value f the three cards. Fur f a Kind. Fur cards with the same value. Ranked by the value f the fur cards. Straight Flush. Five cards f the same suit with cnsecutive values. Ranked by the highest card in the hand. Yur jb is t cmpare several pairs f pker hands and t indicate which, if either, has a higher rank. Input The input file cntains several lines (up t 0 lines), each cntaining the designatin f ten cards: the first five cards are the hand fr the player named Black and the next five cards are the hand fr the player named White. Output Fr each line f input, print a line cntaining ne f the fllwing: Black wins. White wins. Tie. Sample input Sample Output 2H 3D 5S 9C KD 2C 3H 4S 8C AH 2H 4S 4C 2D 4H 2S 8S AS QS 3S 2H 3D 5S 9C KD 2C 3H 4S 8C KH 2H 3D 5S 9C KD 2D 3H 5C 9S KH White wins. Black wins. Black wins. Tie. تمرينهاي خود را حداآثر تا ساعت 2 نيم شب 385//4 ارسال نماييد. تاريخ تحويل تمرين به هيچ وجه تمديد نميشود. 7