标签:racket submit ios stat names ++ cti strlen source
已知正整数k满足2<=k<=9,现给出长度最大为30位的十进制非负整数c,求所有能整除c的k。
30
2 3 5 6
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
char s[31];
int main()
{
int yv=0,q=0;
scanf("%s",s);
int l=strlen(s);
for(int i=2;i<=9;i++)
{
yv=0;
for(int j=0;j<l;j++)
{
yv=yv*10+(s[j]-‘0‘);
yv=yv%i;
}
if(yv==0)
{
cout<<i<<" ";
q=1;
}
}
if(q==0)
{
cout<<"none";
}
return 0;
}
标签:racket submit ios stat names ++ cti strlen source
原文地址:http://www.cnblogs.com/lyqlyq/p/6596937.html