80 fen,不嘻嘻
  • 板块P1151 子数整数
  • 楼主twbtwb
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/10/15 22:48
  • 上次更新2024/10/16 12:18:11
查看原帖
80 fen,不嘻嘻
1371605
twbtwb楼主2024/10/15 22:48

#include <iostream>
using namespace std;

int main() {
    int k,p;
    cin >> k;
    for (int num = 10000; num <= 30000; num++) {
        int a = num / 100;
        int b = (num % 10000) / 10;
        int c = num % 1000;
        if (a % k == 0 && b % k == 0 && c % k == 0) {
            cout << num << endl;
            p=1;
        }
    }
    if(p==0) cout<<"No";
    return 0;
}
2024/10/15 22:48
加载中...