ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1877. Bicycle Codes

My code is accepted.
Posted by mars 6 Apr 2020 01:10
#include<iostream>
using namespace std;
int main(){
    int a,b, thief[10000],i=0;
    cin>>a;
    cin>>b;
    int count = 0;
    for (int i = 0;i<10000;i++){
        thief[i] = i;
    //    cout<<thief[i]<<" ";

    }
    for(i=0;i<10000;i++){
        //cout<<"first"<<i<<endl;
        if(a==thief[i]||b==thief[i+1]){
            count++;

        }
    //    cout<<"thief["<<i<<"]"<<thief[i]<<"\t"<<"thief["<<i+1<<"]"<<thief[i+1]<<endl;
        i=i+1;
        //cout<<"thief"<<i<<endl;


    }
    if(count>0)
    cout<<"yes";
    else
    cout<<"no";
}
Re: My code is accepted.
Posted by vivekreddy 1 Mar 2024 21:15
This code is not very efficient.


Try this code instead:


#include <iostream>
using namespace std;

int main(){
    int key1;cin>>key1;
    int key2;cin>>key2;
    if((key1%2==0) || key2%2!=0){
        cout<<"yes"<<endl;
    }
    else{
        cout<<"no"<<endl;
    }

    return 0;
}

Edited by author 01.03.2024 21:16

Edited by author 01.03.2024 21:16