蓝桥2015A
#include <iostream>
using namespace std;
void fun(int x,int a[]){
a[x]=a[x]*a[x+1];
a[x+1]=0;
cout<<a[x]<<" "<<a[x+1]<<endl;
}
void fun2(int y,int a[]){
a[y+1]=a[y]/y;
a[y]=y;
}
int sum(int a[]){
int he=0;
for(int i=1;i<=49;i++){
he+=a[i];
}
return he;
}
int main(){
int a[55];
for(int i=1;i<=1;i++){
for(int k=1;k<=49;k++){
a[k]=k;
}
fun(i,a);
for(int j=i+2;j<=3;j++){
fun(j,a);
cout<<a[3]<<" "<<a[4]<<endl;
for(int k=1;k<=49;k++){
cout<<k<<":"<<a[k]<<endl;
cout<<sum(a)<<endl;
if(sum(a)==2015){
cout<<i<<endl;
break;
}
fun2(j,a);
}
}
}
system ("pause");
return 0;
}