lunes, 9 de marzo de 2015

Nuestro primer desafío en HackerRank - Solve me first C++ – World –Teleconferencias – Automovil – Abogado – Culture – Domains – Motor

HackerRank Desafios de programación

En una anterior entrada hablamos sobre los desafíos de programación deHackerCademy, siguiendo con la idea resolveremos el primer desafió que se nos propone en esta plataforma, y analizaremos el enunciado del desafío y sus entradas y salidas.

Para acceder al desafío clic eneste enlace

"Problem Statement

This is an introductory challenge. The purpose of this challenge is to give you a working I/O template in your preferred language. It includes scanning two integers from STDIN, calling a function, returning a value, and printing it to STDOUT.

The task is to scan two numbers from STDIN, and print the sum A+B on STDOUT. The code has already been provided for most of the popular languages. This is primarily for you to read and inspect how the IO is handled.

Note: The code has been saved in a template, which you can submit if you want. Or, you may try rewriting it and building it up from scratch."

Básicamente nos explica las entradas y salidas del algoritmo que debemos desarrollar, menciona que se leerán por la entrada estándar de datosSTDIN (el teclado) dos enteros que serán pasados como parámetros a una función que nos retornará la suma de ambos enteros.

HackerRank Desafios de programación

Cada desafío que queremos realizar contendrá unas entradas y salidas correspondientes, en este caso las entradas son dos números enteros Ay B y la salida, la suma de ambos enteros.

HackerRank Desafios de programación

A su vez, contendrán ciertas restricciones a tomar en cuenta, por ejemplo los números enteros A y B serán números que se encuentren en el intervalo [1,1000]. Sí por alguna razón el intervalo superara el valor de 32767 en vez de llegar hasta 1000, entonces deberíamos usar un dato de tipolong (entero largo).

Dato tipo int:
Con signo : -32768 a 32767
Sin signo: 0 a 65535

Dato tipo long:
Con signo: -2147483648 a 2147483647
Sin signo: 0 a 4294967295

HackerRank Desafios de programación

Ejemplos de entrada y salida: Al tener listo nuestro programa (sí lo estamos realizando en nuestro IDE o editor de texto preferido), si al ejecutarlo e ingresar estos valores de prueba, nos arroja la misma salida entonces nuestro programa está 99,99% correcto.¿Porqué 99,99% correcto? en muchas ocasiones las entradas y salidas de ejemplo que se nos proporcionan tienden a ser las mastriviales, por lo que siempre es buenointentar romper nuestro programa con todos los casos de prueba que se nos ocurran, una vez estemos seguros que funciona al 100% hacemos clic enRun Code para ejecutar el código que tenemos en nuestrobuffer de HackerCademy.

HackerRank Desafios de programación

Sí todo funciona correctamente superaremos el caso de prueba. Esimportante mencionar quelas salidas tienen que ser tal cual se nos indica, sí estas poseen espacios la nuestra también deben tenerlos, sí son resultados con saltos de línea nuestras salidas también deben poseer saltos de línea.

HackerRank Desafios de programación

Posterior a esto hacemos clic enSubmit Code,se realizarán varios casos de prueba con nuestro algoritmo y sí no se encuentran errores en las salidas se nos indicará queha sido aceptado!.

HackerRank Desafios de programación

Solución del desafío en C++:

#include cmath
#include cstdio
#include vector
#include iostream
#include algorithm
using namespace std;


int solveMeFirst(int a, int b) {
return a+b;
}
int main() {
int num1, num2;
int sum;
cinnum1num2;
sum = solveMeFirst(num1,num2);
coutsum;
return 0;
}

Como mencionamos anteriormente, leemos dos números enteros, luego pasamos como parámetro ambos números enteros y retornamos su suma. El resultado de esta suma es almacenado en la variable sum y finalmente imprimimos por pantalla el resultado.


También te podría interesar:

  1. Operaciones básicas para vectores de objetos en c++ (Acceso, Inserción, Tamaño y eliminación)
  2. Algoritmo - Factorial de un número en C++
  3. Aprende java desde 0 con JavaYa!
  4. Valor Absoluto de un número en c++
  5. 22 guías y libros gratis para aprender a programar en c++


Proud Italian cook WordPress hosting Service business software personal injury attorney torrance mesothelioma claims FORENSICS ONLINE COURSE Dallas Mesothelioma Attorneys MORTGAGE ADVISER Cheap Car Insurance for Ladies life insurance co lincoln Social media platforms Online casino Data Recovery Raid domains yahoo car insurance quotes colorado car donate baltimore mesothelioma attorneys Social media management Cheap car insurance for ladies mesothelioma attorney directory Motor replacements orlando criminal attorney WordPress theme designers Email bulk service Royalty Free Images Stock Car Insurance Quotes MN ANNUITY SETTLEMENT automobile accident attorney Criminal lawyer Motor Replacements Better Conference Calls Donate Car To Charity CALIFORNIA mesothelioma symptoms structured settlement buyers Home Phone Internet Bundle Psd to WordPress CHEAP CAR INSURANCE IN VIRGINIA Tech school houston tx auto insurance car accident lawyers buy structured settlements Claim ONLINE COLLEDGES structered settlement webex costs Seo companies Virtual Data Rooms Donate Your Car Sacramento mesothelioma attorneys futuristic architecture Casino Donate Car for Tax Credit AUTO ACCIDENT ATTORNEY refinance with poor credit low credit line credit cards Mobile casino donating used cars to charity california law lemon Casino reviews criminal defense attorneys florida BEST CRIMINAL LAWYER IN ARIZONA Make money online Australia Auto Mobile Insurance Quote DUI lawyer mesothelioma lawsuits Computer science classes online Hire php programmers Criminal defense lawyer sell my structured settlement Psychic for Free Live casino accident lawyers in los angeles compare life assurance Asbestos Lawyers Social media tools Hire php developers Dwi lawyer Donate Car to Charity California LIFE INSURANCE CO LINCOLN los angeles auto accident attorneys Auto Mobile Shipping Quote Php programmers for hire Mortgage Hire php developer Bankruptcy lawyer CHEAP DOMAIN REGISTRATION HOSTING royalty free images stock bowne virtual data room hughes net business Php programmers asbestos exposure lawyers Best social media platforms for business Email Bulk Service New social media platforms Business finance group DONATE OLD CARS TO CHARITY Car insurance quotes MN insurance medical temporary washington mesothelioma attorney Social media platforms for business Hard drive data recovery services CAR INSURANCE QUOTES PA Custom WordPress theme designer Car Insurance Quotes Colorado personal injury lawyer Seo services Best Seo company holland michigan college Business management software NUNAVUT CULTURE asbestos lawyers Best social media platforms Seo company Online Christmas cards refinance with bad credit PHD on Counseling Education Online Classes Custom Christmas cards Photo Christmas cards WordPress themes for designers los angeles motorcycle accident lawyer Forex Trading Platform Italian cooking school federal criminal defense attorney auto insurance yuba city ca selling annuity payments for cash Motor Insurance Quotes injury lawyers hosted predictive dialers Social media campaigns structured settlement broker Social media examiner buy gift card car accident lawyer in san diego domain yahoo anti spam exchange server Online Motor Insurance Quotes HARDDRIVE DATA RECOVERY SERVICES Royalty free images stock Html email Christmas cards Insurance Companies Psd to html selling structured settlement how to donate a car in california att call conference Annuity Settlements DAYTON FREIGHT LINES Life Insurance Co Lincoln DONATE YOUR CAR FOR MONEY life insurance quotes ONLINE MOTOR INSURANCE QUOTES asbestos lung cancer Webex Costs DONATE YOUR CAR FOR KIDS Adobe illustrator classes donate your car for kids Social media strategies caraccidentlawyer Learning adobe illustrator auto accident lawyer san francisco See more at http//wwwginfostopnet/ seattle mesothelioma lawyer Mesothelioma Law Firm Car Insurance Companies asterisk call center software Donate Cars in MA firm law mesothelioma workers compensation lawyer los angeles Donate a Car in Maryland Car Donate How to Donate A Car in California Sell Annuity Payment Donate Your Car for Kids Register Free Domains Structures Annuity Settlement DONATE CARS ILLINOIS MET AUTO Nunavut Culture Best Criminal Lawyers in Arizona Dayton Freight Lines Hard drive Data Recovery Services Dallas mesothelioma attorneys register free domains truck accident attorney texas Cheap Auto Insurance in VA Register free domains Cheap Domain Registration Hosting Donating a Car in Maryland emergency response plan ppt Donate Cars Illinois Asbestos Lung Cancer hair removal washington dc Criminal Defense Attorneys Florida Health Records Personal Health Record motorcycle accident lawyer california Car Insurance Quotes Utah Holland Michigan College online colledges Online Colleges Paperport Promotional Code Personal Injury Lawyers World Trade Center Footage motorcycle lawyer los angeles Massage School Dallas Texas HOW TO DONATE A CAR IN CALIFORNIA Donating a car in Maryland Donate Old Cars to Charity anti spam appliance Donate your car Sacramento Low Credit Line Credit Cards canada personals yahoo online criminal justice degree structured settlement purchasers injury lawyers west palm beach Donate your Car for Money home phone internet bundle Met Auto personal injury accident lawyer adverse credit remortgage Forensics Online Course meso lawyer Donating Used Cars to Charity structured settlement brokers Neuson Car Insurance Quotes PA Personal Injury Law Firm Car Insurance in South Dakota car insurance quotes mn DONATING USED CARS TO CHARITY CHEAP CAR INSURANCE FOR LADIES Cheap Car Insurance in Virginia WORLD TRADE CENTER FOOTAGE cloud identity and access management car crash attorneys structured settlement annuity companies buying structured settlements Futuristic Architecture Mortgage Adviser DALLAS MESOTHELIOMA ATTORNEYS NEUSON Online College Course Automobile Accident Attorney Auto Accident Attorney Car Accident Lawyers CAR INSURANCE QUOTES COLORADO Criminal lawyer Miami Injury Lawyers mesothelioma settlements amounts mesothelioma law firm

No hay comentarios:

Publicar un comentario