My issue
My code
#include <iostream>
using namespace std;
int main() {
// your code goes here
int T;
cin>>T;
while(T--){
int X,Y,Z;
cin>>X>>Y>>Z;
cout<<(X*Y)+Z/3<<endl;
}
return 0;
}
Problem Link: LASTLEVELS Problem - CodeChef
@satyam123z you logic is not correct
i have coded it in simpler way so that u can get it. let me know in case u won’t get it.
include
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t–)
{
int x,y,z;
cin>>x>>y>>z;
int ans=xy;
int r=x%3;
x=x/3;
if(r>0)
{
ans+=xz;
}
else
{
if(x>0)
{
x–;
}
ans+=x*z;
}
cout<<ans<<endl;
}
return 0;
}