1 solutions

  • 0
    @ 2025-11-5 17:31:25

    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

    Information

    ID
    18516
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By