暴力 40pts 求调
查看原帖
暴力 40pts 求调
831011
Deltary_楼主2023/4/26 16:40
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
const char sp=' ';

int main(){
	int need,ans=0;
	scanf("%d",&need);
	need-=4;
	int stick[10]={6,2,5,5,4,5,6,3,7,6};
	for(int A=0;A<10;A++){
		for(int B=0;B<10;B++){
			if(A+B>=10){
				if(stick[A]+stick[B]+
				stick[(A+B)/10]+stick[(A+B)%10]==need){
					ans++;
					cout<<A<<"+"<<B<<"="<<A+B<<endl;
				}
			}
			if(stick[A]+stick[B]+stick[A+B]==need){
				ans++;
				cout<<A<<"+"<<B<<"="<<A+B<<endl; 
			}
		
		}
	}
	cout<<ans<<endl;
	return 0;
}
2023/4/26 16:40
加载中...