|
|
вернуться в форумMy code is accepted. Послано mars 6 апр 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. 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 |
|
|