Please read the new rule regarding the restriction on the use of AI tools. ×

Asking QUESTION from a newbie

Revision en1, by ric_hagsfd, 2023-02-10 05:45:55

hi guys, Im new to codeforce. My question is for problem# 318A EVEN ODD I've used ordered map in this question but not getting the answer. Please do let me know where Im wrong........

int main() { int i, j; map<int, int> m; int n, k; cin>>n>>k;

for (i =1, j=1; j <=n; i++, j+2)
{
    m[i]= j;
}

for (i, j=2; j <=n; i++, j+2)
{
    m[i]= j;
}

auto it= m.find(k);
if(it!=m.end())
{ 
    cout<<endl<<(*it).second;

}

}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ric_hagsfd 2023-02-10 05:45:55 570 please please do let me know where I'm wrong in this code....... :) (published)