1 条题解

  • 0
    @ 2024-9-9 16:39:20

    C :

    #include<stdio.h>
    #include<string.h>
    int main()
    {char n[1000];while(scanf("%s",n) && n[0] != '0'){int i, s=0;for(i = 0; i < strlen(n); i++)s = (s * 10 + (n[i]- '0')) % 17;if(s==0)printf("1\n");else printf("0\n");}return 0;}
    
    

    C++ :

    #include<iostream>
    #include<string>
    using namespace std;
    int main()
    {
        string str;
        while(cin>>str && str!="0")
        {
            int i=0,tmp=0;
            while(i<str.size())
            {
                tmp=(tmp*10+(str[i]-'0'))%17;
                i++;
            }
            if(tmp%17==0)
                cout<<1<<endl;
            else
                cout<<0<<endl;
        }
    }
    
    
    • 1

    信息

    ID
    508
    时间
    1000ms
    内存
    128MiB
    难度
    5
    标签
    递交数
    2
    已通过
    1
    上传者