1 solutions

  • 0
    @ 2025-11-5 19:51:31

    C :

    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
    	int a,b,c;
    	//scanf("%d%d%d",&a,&b,&c);
    	for(int a=0;a<=5;a++)
    		for(int b=0;b<=5;b++)
    			for(int c=0;c<=9;c++)
    				if(((a+b)*100+(b+c)*10+c*2)==532)
    					printf("%d %d %d\n",a,b,c);
    	//system("pause");
    	return 0;
    }
    

    C++ :

    #include<iostream>
    #include <cstdio>
    using namespace std;
    int main()
    {
        //freopen("data.out", "w", stdout);
        int a,b,c;
        for(int i=100; i<1000; i++)
        {
            a=i/100;
            b=i/10-a*10;
            c=i%10;
            if((i+b*100+c*10+c)==532)
            {
                cout<<a<<" "<<b<<" "<<c;
                cout<<endl;
            }
        }
        return 0;
    }
    
    

    Java :

    public class Main {
        public static void main(String[] args) {
            for (int a = 0; a < 9; a++) {
                for (int b = 0; b < 9; b++) {
                    for (int c = 0; c < 9; c++) {
                        if(a*100+b*10+c+b*100+c*10+c == 532){
                            System.out.print(a+" ");
                            System.out.print(b+" ");
                            System.out.print(c+" ");
                        }
                    }
                }
            }
        }
    }
    
    • 1

    Information

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