I can’t seem to be able to solve the problem
include
using namespace std;
int main() {
int t;
cin>>t;
while(t–){
int X,Y,Z;
cin>>X>>Y>>Z;
cout<<X / 3 * Z<<endl;
}
return 0;
}
Problem Link: TEA Problem - CodeChef
I can’t seem to be able to solve the problem
include
using namespace std;
int main() {
int t;
cin>>t;
while(t–){
int X,Y,Z;
cin>>X>>Y>>Z;
cout<<X / 3 * Z<<endl;
}
return 0;
}
Problem Link: TEA Problem - CodeChef
@marigold888
For condition for x=1 you will not be getting the right output
because 1/3 is 0 and 0*z is zero but the output must be 1.
So for any positive integer less than 3 you will not be getting the correct output.
This my program
include
using namespace std;
int main() {
int t;
cin>>t;
while(t–)
{
int x,y,z,a;
cin>>x>>y>>z;
if(x%y!=0)
{int a= (x/y+1)*z;
cout<<a<<endl;}
else
{a=(x/y)*z;
cout<<a<<endl;}
}
return 0;
}
while(t–)
(x/3)*z