1 solutions

  • 0
    @ 2025-11-5 15:55:27

    C :

    #include<stdio.h>
    main()
    {
    	int x,y,z;
    	int n;
    	int flag = 0;
    	scanf("%d",&n);
    	for(x = 1;x<n;x++)
    	{
    		for(y = 1;y<n;y++)
    		{
    			for(z = 1;z<n;z++)
    			{
    				if(x+y+z == n && 10*x+5*y+z == 100)
    				{
    					printf("%d,%d,%d\n",x,y,z);
    					flag++;
    				}
    			}
    		}
    	}
    	if(!flag)
    		printf("不能兑换");
    	return 0;
    }
    
    • 1

    【设计型】第6章:循环控制结构 零钱兑换

    Information

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