1 solutions

  • 0
    @ 2023-1-16 14:17:22
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {	//num计数满足条件的数的个数 
    	int k, sub1, sub2, sub3, num = 0;
    	cin >> k;
    	//遍历10000到30000之间的五位数
    	for(int i = 10000; i <= 30000; i++){
    		sub1 = i/100;
    		sub2 = i/10%1000;
    		sub3 = i%1000;
    		if(sub1%k == 0 && sub2%k == 0 && sub3%k == 0){
    			cout << i << endl;
    			num++;
    		}
    	} 
    	//如果无解,则输出“no";
    	if(num == 0){
    		cout << "No";
    	} 
    	return 0;
    }
    
    
    • 1

    Information

    ID
    794
    Time
    1000ms
    Memory
    32MiB
    Difficulty
    10
    Tags
    # Submissions
    2
    Accepted
    2
    Uploaded By