Event Timing

Bob is making a new application for Android phones. Front-end of his app has a button like this: Whe…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

What’s the problem with this code?
It’s giving desired results…

#include<bits/stdc++.h>
using namespace std;

int main()
{
     int test, p, k, d;
     cin>>test;
     for(int i=1; i<=test; i++) {
           cin>>p>>k>>d;
           int quot = k/d;
           int remain = k%d;
           if(remain!=0) {
                    quot++;
             }
           int ans = p+d*quot;
           cout<<"Case "<<i<<": "<<ans<<endl;
   }
return 0;

}

same thing is happening with me too

#include<bits/stdc++.h>
#include
using namespace std;
int main()
{
int t;
cin>>t;
int r[t];
for(int i=0;i<t;i++)
{
int p,k,d;
cin>>p>>k>>d;
if(k%d==0)
{
r[i]=k/d;
}
else
{
r[i]=(k/d)+1;
}
r[i]=p+r[i]*d;
}
for(int i=0;i<t;i++)
{
cout<<"Case “<<i+1<<”: "<<r[i]<<endl;
}
}

Is there any wrong in the question ? if the time is equal to the needed time than also it needs to turn again ? why … i got wa for that then i somehow thought about that and got ac. Please describe that