28pts求调(悬一关)
查看原帖
28pts求调(悬一关)
369421
DF_cloud楼主2023/10/10 18:05
#include<bits/stdc++.h>
using namespace std;
int x,y;
vector<string> opt;
int main(){
	cin>>x>>y;
	int a,b,c;
	a=x,b=y;
	c=0;
	if(x<y){
		while(x){
			if(x%2){
				opt.push_back("B C C");
				c=b+c;
			}
			opt.push_back("B B B");
			b=b*2;
			x=x/2;
		}
	}
	else{
		while(y){
			if(y%2){
				opt.push_back("A C C");
				c=a+c;
			}
			opt.push_back("A A A");
			a=a*2;
			y=y/2;
		}
	}
	cout<<opt.size()<<endl;
	for(auto i:opt){
		cout<<i<<endl;
	}
	cout<<"C"<<endl;
	return 0;
}

提交记录

2023/10/10 18:05
加载中...