글
백준 15552번 빠른 A+B(Java, C#)
자바
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int N = Integer.parseInt(br.readLine());
StringTokenizer st;
for (int i = 0; i < N; i++)
{
st = new StringTokenizer(br.readLine()," ");
bw.write((Integer.parseInt(st.nextToken()) + Integer.parseInt(st.nextToken()))+ "\n");
}
br.close();
bw.flush();
bw.close();
}
}
//////////////////////
C#
using System;
using System.Text;
namespace Baekjoon {
class Program {
static void Main() {
StringBuilder sb = new StringBuilder();
int b = int.Parse(Console.ReadLine());
for(int i = 1;i<=b;i++)
{
string[] ss = Console.ReadLine().Split();
int c = int.Parse(ss[0]);
int d = int.Parse(ss[1]);
sb.Append(c + d + "\n");
}
Console.WriteLine(sb.ToString());
}
}
}
'백준 프로그래밍' 카테고리의 다른 글
백준 11022번 A + B - 8(JAVA, C#) (0) | 2023.02.14 |
---|---|
백준 11021번 A+B-7(JAVA, C#) (0) | 2023.02.14 |
백준 25304번 영수증(JAVA, C#) (0) | 2023.02.14 |
백준 8393번 합(JAVA, C#) (0) | 2023.02.14 |
백준 10950번 A+B-3(JAVA, C#) (0) | 2023.02.14 |