Cod sursa(job #1056889)

Utilizator andreimaresuMaresu Andrei andreimaresu Data 14 decembrie 2013 13:51:36
Problema Progresie Scor 0
Compilator cpp Status done
Runda ONIS 2014, Runda 1 Marime 0.37 kb
#include <iostream>
#include <stdio.h>

using namespace std;

int main()
{
    freopen("progresie.in","r",stdin);
    freopen("progresie.out","w",stdout);

    long long int nr,T,N,R,k,j,l,h,mid;
    cin >> T;
    for(int i=0;i<T;i++)
    {
        cin >> N >> R;
        k=R*(N-1)+1;
        j=k*(k-1)+1;
        cout <<j << endl;
    }
    return 0;
}