My issue
what should be the answer for the test case n=4, k=2
According to me the digits will be 1100 so the sum/finalanswer will be 2
but according to the accepted code it is 3 i.e the digits they are choosing are 1002
I want to know weather i am correct or not
Accepted code
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;cin>>t;
while(t--){
long long n,k;cin>>n>>k;
long long l =(3*k+3)/2;
long long ans = 3*(n/l);
if(n%(l) > 0) ans+=1;
if(n%l > k+1) ans += 2;
cout<<ans<<"\n";
// cout<<n-k<<"\n";
}
return 0;
}
Problem Link: NOPALINDROME Problem - CodeChef