1 Day 1 Algorithms
[2018.12.11] Solve Me First
곰돌찌
2018. 12. 14. 08:54
Problem
complete the function solveMeFirst to compute the sum of two integers
Function prototype:
int solveMeFirst(int a, int b);
where,
- a is the first integer input.
- b is the second integer input
Return values
- sum of the above two integers
Sample Input
a = 2
b = 3
Sample Output
5
Explanation
The sum of the two integers and is computed as: .
How I solved the problem
## 단순히 더해서 리턴하는 문제!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int solveMeFirst(int a, int b) { // Hint: Type return a+b; below return a + b; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int a; a = in.nextInt(); int b; b = in.nextInt(); int sum; sum = solveMeFirst(a, b); System.out.println(sum); } } | cs |
[출처 : https://www.hackerrank.com ]