Cod sursa(job #1056211)
Utilizator | Data | 14 decembrie 2013 12:42:29 | |
---|---|---|---|
Problema | Progresie | Scor | 0 |
Compilator | cpp | Status | done |
Runda | ONIS 2014, Runda 1 | Marime | 0.32 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("progresie.in");
ofstream g("progresie.out");
int main()
{
int n,t,r,x,y,i,j;
f>>t;
for (i=1;i<=t;i++)
{
f>>n>>r;
x=r*(n-1);
y=x*x;
y=y+x+1;
g<<y<<'\n';
}
return 0;
}