Event Timing

Limits: 2s, 512 MB

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


This is a companion discussion topic for the original entry at https://toph.co/p/event-timing

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