题目描述
本题为填空题,只需要算出结果后,在代码中使用输出语句将所填结果输出即可。
把 20192019 分解成 33 个各不相同的正整数之和,并且要求每个正整数都不包含数字 22 和 44,一共有多少种不同的分解方法?
注意交换 33 个整数的顺序被视为同一种方法,例如 1000+1001+181000+1001+18 和 1001+1000+181001+1000+18 被视为同一种。
运行限制
- 最大运行时间:1s
- 最大运行内存: 128M
注意:i<j<k
#include<bits/stdc++.h>
using namespace std;
bool check(int n){
int res;
while(n){
res=n%10;
n/=10;
if(res==2||res==4) return false;
}
return true;
}
int main()
{
int res=0;
for(int i=1;i<2019;i++)
for(int j=i+1;j<2019;j++){
int k=2019-i-j;
if(check(i)&&check(k)&&check(j))
if(j<k) res++;
}
cout<<res<<endl;
}