Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream cin ("echer.in");
- ofstream cout ("echer.out");
- int main()
- {
- int cer,n,m,c1,mi,ma,x,y,c2,k,mut,i;
- cin>>cer;
- cin>>c1>>c2>>m>>n;
- x=m/c1;
- y=n/c2;
- mi=min(x,y);
- ma=max(x,y);
- if(x==y){
- k=3*x-2;
- }else if(ma==mi+1){
- k=3*mi-1;
- }else if((ma-mi)%2==1){
- k=3*mi+2*(ma-mi)-2;
- }else{
- k=3*mi+2*(ma-mi)-3;
- }
- if(cer==1){
- cout<<k;
- }else{
- cout<<"1 ";
- mut=1;
- for(i=1;i<mi;i++){
- cout<<"2 3 1 ";
- mut+=3;
- }
- if(x-y==1){
- cout<<"4";
- }else if(y-x==1){
- cout<<"2";
- }else if(x-y>1){
- mut+=4;
- while(mut<k){
- cout<<"4 6 3 1 ";
- mut+=4;
- }
- mut-=4;
- if(mut<k){
- cout<<"4";
- }
- }else{
- mut+=4;
- while(mut<k){
- cout<<"2 7 5 1 ";
- mut+=4;
- }
- mut-=4;
- if(mut<k){
- cout<<"2";
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement