Cod sursa(job #1055353)

Utilizator cioionutFMI Ionut Ciocoiu cioionut Data 14 decembrie 2013 11:15:51
Problema Progresie Scor 0
Compilator cpp Status done
Runda ONIS 2014, Runda 1 Marime 0.33 kb
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
    ifstream f("progresie.in");
    ofstream g("progresie.out");
    long long int n,t,r,x;
    f>>t;
    for(int i=0;i<t;i++)
    {
        f>>n>>r;
        x=(n-1)*r+1;
        g<<x*(x-1)+1<<"\n";
    }
    f.close();g.close();
    return 0;
}