美文网首页
acm2.3(王者)

acm2.3(王者)

作者: wolfway_d0ff | 来源:发表于2018-12-14 19:48 被阅读0次

    当输入两个数都为0时,截至循环。因为要知道后两位为什么,所以在原有数上乘100,以扩充此数,使用for语句循环输出所有满足整除条件的数
    、、、

    include<iostream>

    using namespace std;
    int main()
    {
    int a, b;
    while (cin >> a >> b)
    {
    if(a==0&&b==0)
    {
    return 0;
    }
    int c;
    c = a * 100;int x = 0;
    for (int i = 0; i < 100; i++)
    {
    if ((c + i) % b == 0)
    {
    if (x != 0)
    {
    cout << " ";
    }
    if (i >= 0 && i <= 9)
    {
    cout << '0';
    }
    cout << i;
    x++;

            }
        }
        cout << endl;
    }
    return 0;
    

    }
    、、、

    相关文章

      网友评论

          本文标题:acm2.3(王者)

          本文链接:https://www.haomeiwen.com/subject/bbkghqtx.html