3 条题解

  • 0
    @ 2021-04-26 14:22:16

    #include <iostream>
    using namespace std;
    int main()
    {
    int x0, y, r;
    cin>>x0;
    cin>>y;
    int x=x0;
    cout<<"0.";
    while( 1 )
    {
    x=x*10;
    r=x/y; // 商的一位数
    cout<<r;

    x=x%y; // 更新余数 (被除数)
    if(x==x0||x==0)
    break;
    }

    if(x%y==0)
    cout<<"No";
    else
    cout<<"Yes";

    return 0;
    }

  • -6

    #include <iostream>
    #include <iomanip>
    using namespace std;
    int main()
    {
    int y,x0;
    cin>>x0>>y;
    cout<<"0.";
    int r, x=x0;
    do
    {
    x=x*10;
    r=x/y; // 商的一位数
    cout<<r;

    x=x%y;
    if(x==0)
    break; // 更新余数 (被除数)
    }while(x!=x0);
    if(x!=0)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
    }

  • 1

信息

ID
1215
难度
6
分类
(无)
标签
递交数
181
已通过
52
通过率
29%
被复制
5
上传者