代码构建和运行完美,但我无法调试我的代码。我是 M1 Macbook Pro 用户,我认为问题出在那儿。活动监视器中显示的 Clion 的架构是 Intel。代码退出,代码 139- 被信号 11- SIGSEGV- 分段错误中断。
代码
// Created by Kashita Talreja on 22/12/20.
//
#include<bits/stdc++.h>
using namespace std;
bool isvalid(int n) {
int tmp = n;
while(tmp) {
int x = (tmp % 10);
if(x > 0 && n % x > 0) return false;
tmp /= 10;
}
return true;
}
void solve() {
int n;
cin >> n;
int ok = 0;
while(!isvalid(n)) {
n++;
}
cout << n << endl;
}
int32_t main() {
int t;
cin>>t;
while(t--) {
solve();
}
return 0;
}