A. Simple Design
看来0~1000分区间还是有简单题的()
就是暴力找每个数,把它每个位置分离相加
找到就退出
#include <iostream>
using namespace std;
void solve()
{
int x, k;
cin >> x >> k;
for (int i = x;; i ++ )
{
int d = i;
int sum = 0;
while (d)
{
sum += d % 10;
d /= 10;
}
if (sum % k == 0)
{
cout << i << endl;
return;
}
}
}
int main()
{
int t;
cin >> t;
while (t -- )
{
solve();
}
return 0;
}
标签:10,Simple,sum,int,while,Design
From: https://www.cnblogs.com/isomer/p/18151867