Untitled
unknown
plain_text
a year ago
409 B
3
Indexable
#define ll long long #define pb push_back #include <bits/stdc++.h> using namespace std; void solve(){ ll n,k; cin>>n>>k; k=min(k,n/2); cout<<k*(2*n-2*k-1)<<"\n"; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); int t; cin>>t; while(t--) solve(); } /* not using formula TLE ll ang=0; while(k--){ ang=ang+n-1+n-2; n-=2; } */
Editor is loading...
Leave a Comment