Help me in solving ANTITRI problem

My issue

What is wrong if we directly print an AP starting with first term L and common difference as L.

My code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	// your code goes here
    int t;cin>>t;
    while(t--){
        ll n,l;
        cin>>n>>l;
        ll a[n];
        for(int i=0;i<n;i++)
        a[i]=l*(i+1);
        for(int i=0;i<n;i++)
        cout<<a[i]<<" ";
        cout<<endl;
    }
}

Problem Link: Anti-Triangle Practice Coding Problem - CodeChef

Let’s say L = 10^9. What would your code output be then?
[10^9, 2\cdot10^9, 3\cdot10^9, ... , N\cdot10^9]
But the Output Format specifies that each integer should be between 1 and 10^9. This constraint is violated.

1 Like