My issue
plz help what is wrong in this code
My code
#include <bits/stdc++.h>
using namespace std;
using ull= long long int;
ull solve(ull a,ull b,ull k){
if(k==0)return 0;
if(a>b){
if(k%2==0)return (k/2)*b;
return a+((k/2)-1)*b;
}
return (k-1)*b;
}
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int t;
ull a,b,k;
cin>>a>>b>>k;
cout<<solve(a,b,k)<<endl;
}
}
Problem Link: Sequence Search Practice Coding Problem