검색결과 리스트
글
Archive/Code_HackerRank
2018. 1. 17. 00:15
[HackerRank]Solve Me First
Complete the function solveMeFirst to compute the sum of two integers.
Function prototype:
int solveMeFirst(int x, int y);
where,
- x is the first integer input.
- y is the second integer input
Return values
- sum of the above two integers
Sample Input
x = 2
y = 3
Sample Output
5
Explanation
The sum of the two integers and is computed as: .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int solveMeFirst(int a, int b) { // Hint: Type return a+b; below: return a+b; } int main() { int num1, num2; int sum; cin>>num1>>num2; sum = solveMeFirst(num1,num2); cout<<sum; return 0; } | cs |
Comment
가장 처음 해커랭크를 어떻게 쓰는지에 대한 문제.
힌트에 써있는대로 'return a+b;'라고만 쓰면 끝.
'Archive > Code_HackerRank' 카테고리의 다른 글
[HackerRank]Plus Minus (0) | 2018.01.17 |
---|---|
[HackerRank]Diagonal Difference (0) | 2018.01.17 |
[HackerRank]A Very Big Sum (0) | 2018.01.17 |
[HackerRank]Compare the Triplets (0) | 2018.01.17 |
[HackerRank]Simple Array Sum (0) | 2018.01.17 |
RECENT COMMENT