2179: Dividable
Result | TIME Limit | MEMORY Limit | Run Times | AC Times | JUDGE |
---|---|---|---|---|---|
![]() | 3s | 8192K | 466 | 198 | Standard |
For two integer n and k(0 < n,k <100000000). Tell if n^k-1 is dividable by (n-1)^2.
This problem contains multiple input, each of which contains two number n and k.
Print "yes" if n^k-1 is dividable by (n-1)^2, otherwise print no.
Sample Input
3 4 3 3
Sample Output
yes no
Problem Source: evil
#include<stdio.h>
int main()
{
int n,k;
while(scanf("%d%d",&n,&k)!=EOF)
{
if(k%(n-1)==0)
printf("yes/n");
else printf("no/n");
}
return 0;
}
//n^k-1=(n-1+1)^k-1 多项式展开公式