Questions D: number of decomposition ( 40785
【Problem Description】
The 2019 is decomposed into three different and positive integers, and each requires a positive integer numbers 2 and 4 are not included, how many different method for decomposing a total of?
Note that the order of switching an integer of 3 is considered the same method, for example, 1000 + 1001 + 1001 + 1000 + 18 and 18 are considered the same.
#include <stdio.h>
int main () {
int i,j,k;
you ii, jj, kk;
int cc=1,z,temp=0;
for(i=1;i<2019;i++)
{
for(j=i+1;j<2019;j++)
{
for(k=j+1;k<2019;k++)
{
if(i+k+j==2019){
ii=i;jj=j;kk=k;cc=1;
while(ii){
z = 10% ii.
if(z==2&&ii!=0){
cc=0;break;
}
if(z==4&&ii!=0){
cc=0;break;
}
ii = ii / 10;
}
while(jj){
of jj = 10%;
if(z==2&&jj!=0){
cc=0;break;
}
if(z==4&&jj!=0){
cc=0;break;
}
jj = jj / 10;
}
while(kk){
= kk of 10%;
if(z==2&&kk!=0){
cc=0;break;
}
if(z==4&&kk!=0){
cc=0;break;
}
kk=kk/10;
}
if(cc) temp++;
}
}
}
}
printf("%d",temp); //40785
}