1 solutions

  • 0
    @ 2025-11-5 17:32:35

    C :

    #include<stdio.h>
    main(){
    		int a,b,c,d,e,sum=0;
    for (a=1;a<=9;a++)
    	for(b=0;b<=9;b++)
    		for(c=0;c<=9;c++)
    			for(d=0;d<=9;d++)
    				for(e=0;e<=9;e++){
    
    					if(a!=4&&b!=4&&c!=4&&e!=4&&d!=4)
    						sum+=1;}
                          printf("%d",sum);
    					
    return 0;
    }
    

    C++ :

    #include<cstdio>
    
    using namespace std;
    	
    int main()
    {
    	int a,b,c,d,e,sum=0;
    	//freopen("1.in","r",stdin);
    	//freopen("1.out","w",stdout);
    	for(a=1;a<=9;a++)
    	 for(b=0;b<=9;b++)
    	  for(c=0;c<=9;c++)
    	  	for(d=0;d<=9;d++)
    	  	 for(e=0;e<=9;e++)
    	  	 	if(a!=4 && b!=4 && c!=4 && d!=4 && e!=4)
    	  	 		sum++;
    	printf("%d\n",sum);	 		
    	return 0;
    }
    
    • 1

    Information

    ID
    18541
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    (None)
    Tags
    (None)
    # Submissions
    0
    Accepted
    0
    Uploaded By