A Plus B


Submit solution

Points: 5 (partial)
Time limit: 3.0s
Memory limit: 64M

Author:
Problem type

Tudor is sitting in math class, on his laptop. Clearly, he is not paying attention in this situation. However, he gets called on by his math teacher to do some problems. Since his math teacher did not expect much from Tudor, he only needs to do some simple addition problems. However, simple for you and I may not be simple for Tudor, so please help him!

Input

The first line will contain an integer N (1 \le N \le 100\,000), the number of addition problems Tudor needs to do. The next N lines will each contain two space-separated integers whose absolute value is less than 1\,000\,000\,000, the two integers Tudor needs to add.

Output

Output N lines of one integer each, the solutions to the addition problems in order.

Sample Input

2
1 1
-1 0

Sample Output

2
-1

Comments


  • 0
    Blond  commented on March 20, 2023, 2:46 p.m.

    include<iostream>

    using namespace std;

    int main(){int a,x,y; cin>>a;

    for(int i=1;i<=a;i++){ cin>>x>>y; cout<<x+y<<endl;} return 0;}


  • 0
    Blond  commented on March 20, 2023, 2:34 p.m.

    include<iostream>

    using namespace std; int main(){

     int a,b,s,n;  
      cin>>n;
      if(n>1 && n<=100000){
            for(int i=1;i<=n;i++)
    
          cin>>a>>b;}
         if(a<1000000000 && b<1000000000){
          s=a+b;   }
         cout<<n<<endl<<s;
            return 0;}

  • -1
    LiAnthony123  commented on March 17, 2023, 10:03 a.m.

    Porque me da error


  • -1
    LiAnthony123  commented on March 17, 2023, 10:02 a.m. edited

    int n,x,a,b; cin>>n; cout<<"\n"; if(n<=100000){ for(int i=1;i<=n;i++){

    if(i<=n){
        cin>>a; 
        cout<<"\n";
        cin>>b;
        cout<<"\n";
        if((a<=1000000000)&&(b<=1000000000)){
        x=a+b;
        cout<<"\n";
        cout<<"La solucion es: "<<x<<"\n";
        }
        }else if(i>n){
            cout<<"Numero de problemas agotados";
            }   
    }
    
    }

    • -1
      x93bd  commented on March 17, 2023, 12:32 p.m. edited

      Solo tienes que leer dos números de input y sumarlos, no tienes que recorrer ningún rango, además, nunca uses debug en lo que mandes al dmoj, en el caso de prueba se verifica que la salida del programa sea exactamente la esperada, no una con información innecesaria

      PD: no tienes que imprimir un salto de linea después de leer la información


  • -3
    YanMiguelCespedesVarela  commented on Feb. 28, 2023, 11:08 a.m.

    include<iostream>

    using namespace std; int main() { int a,b,c,d, e = 0; cin>>a>>b>>c>>d; e = ((a+b)+1)/(d*c); cout << "Resultado: "<<e; return 0;
    } que puedo hacer basandome en esto ?


  • -2
    Jose_Bello  commented on Jan. 31, 2023, 11:11 p.m. edited

    J


  • -1
    Rolando  commented on July 19, 2022, 11:14 a.m. edit 2

    .


  • 4
    PedroPabloAB  commented on June 24, 2021, 11:25 a.m.

    Por ejemplo, en vez de escribir cout<<"Hola"<<endl;

    puedes escribir cout<<"Hola\n";

    o cout<<"Hola"<<"\n";


  • 1
    PedroPabloAB  commented on June 24, 2021, 11:22 a.m.

    Ahmed05 trata de no utilizar <<endl, eso puede ponerlo más lento, mejor utiliza \n o si no utiliza las funciones scanf y printf de la librería stdio.h