Cod sursa(job #1420906)

Utilizator UPB_MinionsUPB Ciurel Grigore Tiu UPB_Minions Data 19 aprilie 2015 09:47:31
Problema A+B Scor 0
Compilator java Status done
Runda Arhiva de probleme Marime 1.05 kb

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author razvan
 */
public class Main {
    public static void main (String args[]) throws FileNotFoundException {
        int a;
        int b;
        PrintStream console = System.out;
        System.setIn(new FileInputStream("adunare.in"));
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        
        int c = a + b;
        
        PrintStream ptr = new PrintStream(new BufferedOutputStream(new FileOutputStream("adunare.out")), true);
        System.setOut(ptr);
        System.out.println(c);
        
        System.setOut(console);
    }
}