Cod sursa(job #1055124)

Utilizator R4DIC4LTeodorescu Oana Maria R4DIC4L Data 14 decembrie 2013 10:52:36
Problema Progresie Scor 0
Compilator cpp Status done
Runda ONIS 2014, Runda 1 Marime 0.28 kb
#include <fstream>
using namespace std;
ifstream f("progresie.in");
ofstream g("progresie.out");
int main()
{
    int t, n, r;
    f >> t;
    while(t --)
    {
        f >> n >> r;
        int k = (n - 1)*r + 1;
        g << 1 + (k - 1)*k << "\n";
    }
    return 0;
}