#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cmath>
#include <algorithm>
using namespace std;
int main()
{
string s;
while (cin >> s)
{
if (s == "0")
{
break;
}
if (s.length() < 2)
{
int n = 0;
for (int i = 0; i < s.length(); i++)
{
n = n * 10 + int(s[i] - '0');
}
bool e = (n % 17 == 0);
cout << e << endl;
}
else
{
int w = 0;
for (int i = 0; i <s.length();)
{
if (w >= 17)
{
w = w % 17;
}
else
{
w = w * 10 + int(s[i] - '0');
i++;
}
}
//cout << w << endl;
bool e = (w % 17 == 0);
cout << e << endl;
}
}
return 0;
}
c++判断是不是17的倍数【数字较大,超出long的范围】
于 2023-12-18 18:48:09 首次发布