BOJ 15552 빠른 A+B

1 개요[ | ]

BOJ 15552 빠른 A+B

2 C[ | ]

#include <stdio.h>
int main() {
	int T;
	scanf("%d", &T);
	int A, B;
	for(int tc=1; tc<=T; tc++) {
		scanf("%d %d", &A, &B);
		printf("%d\n", A+B);
	}
}

3 C++[ | ]

#include <iostream>
using namespace std;
int main() {
	int T;
	scanf("%d", &T);
	int A, B;
	for(int tc=1; tc<=T; tc++) {
		scanf("%d %d", &A, &B);
		printf("%d\n", A+B);
	}
}
#include <iostream>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int T, A, B;
	cin >> T;
	for(int tc=1; tc<=T; tc++) {
		cin >> A >> B;
        cout << A+B << '\n';
	}
}

4 Java[ | ]

import java.util.*;
import java.io.*;
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());
        String line;
        int a, b;
        for(int i=0; i<n; i++) {
            line = br.readLine();
            String[] nums = line.split(" ");
            a = Integer.parseInt(nums[0]);
            b = Integer.parseInt(nums[1]);
            bw.write( String.valueOf(a+b) + "\n" );
        }
        bw.flush();
    }
}
import java.io.*;
public class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        StringBuilder sb = new StringBuilder();
        int n = Integer.parseInt(br.readLine());
        String line;
        int a, b;
        for(int i=0; i<n; i++) {
            line = br.readLine();
            String[] nums = line.split(" ");
            a = Integer.parseInt(nums[0]);
            b = Integer.parseInt(nums[1]);
            sb.append( String.valueOf(a+b) + "\n" );
        }
        System.out.print( sb );
    }
}

5 Perl[ | ]

for (1 .. <>) {
    ($a, $b) = (split / /, <>);
    printf("%d\n", $a + $b);
}

6 PHP[ | ]

<?php
fscanf(STDIN,"%d",$N);
ob_start();
for( $i=0; $i<$N; $i++ ) {
    fscanf(STDIN,"%d %d",$a,$b);
    echo ($a+$b) . "\n";
}
ob_flush();

7 Python[ | ]

import sys
n = int(sys.stdin.readline())
for i in range(n):
    a,b = map(int,sys.stdin.readline().split())
    print( a+b )
import sys
n = int(sys.stdin.readline())
for i in range(n):
    arr = sys.stdin.readline().split()
    print( int(arr[0])+int(arr[1]) )
import sys
n = int(input())
for i in range(n):
    a, b = map(int,sys.stdin.readline().split())
    print( a+b )
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}