C++ :
#include<iostream> using namespace std; int main() { int a,b,c,d,e=0; for (a=1;a<=9;++a) for (b=1;b<=20;++b) for (c=1;c<=42;++c) for (d=1;d<=83;++d) if ((10*a+5*b+2*c+d==100)&&(a+b+c+d==40)) e++; cout<<e<<endl; return 0; }
By signing up a 算道OJ universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 算道OJ universal account