Created
November 18, 2016 05:11
-
-
Save RicardoLara/ffab3b4627abb079e271ca0e067e01e5 to your computer and use it in GitHub Desktop.
Varinia - Producto de nums con DV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //#include<bits/stdc++.h> | |
| #include<iostream> | |
| #include<stdio.h> | |
| using namespace std; | |
| //Funcion recursiva, mando dos longs para partir el segundo | |
| long long mult(long long A, long long B){ | |
| long X; //Variable auxiliar | |
| if(B == 1) return A; // Caso Base | |
| //Si no, Parto y repito | |
| X = B/2 + B%2; | |
| return mult(A , B/2) + mult(A , X); | |
| } | |
| int main(){ | |
| long long a,b; | |
| cout << "Primer numero pls: "; cin >> a; | |
| cout << "Segundo numero pls: "; cin >> b; | |
| //Llamada a la funcion y gg | |
| cout << mult(a,b) << endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment