UVA 1069

题目链接 :http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=255&page=show_problem&problem=3510

题意: 求给你的多项式对于n的取值是否答案总是为整数 

做法是把1..k+1全部代入看结果是否都为整数,白书P124页有具体证明



#include 
#include
#include
#include
#include
#define LL long long
using namespace std;
LL d,c[105];
char s[10005];
LL pow_mod(LL x,LL y){
    LL ret=1;
    while(y){
        if(y&1)
        ret=ret*x%d;
        y>>=1;
        x=x*x%d;
    }
    return ret;
}
int main()
{
    LL ics=0,tmp,tmp2,k,f;
    while(~scanf("%s",s)){
        LL l=strlen(s);
        if(s[0]=='.')
        break;
        memset(c,0,sizeof(c));
        LL i=1;
        k=0;
        while(ik)
            k=tmp2;
        }
        while(!isdigit(s[i]))
        i++;
        d=0;
        while(isdigit(s[i])&&i


你可能感兴趣的:(数学题)