标签:des style http color os strong io width
SequenceCrawling in process... Crawling failed Time Limit:3000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Description
Input
Output
Sample Input
| input | output |
|---|---|
1 2 2 11 0 0 |
1 2 |
题意:如题。
思路:哇。一开始看错题啦。不难发现f(n)的通项啦。
AC代码:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <stdlib.h>
using namespace std;
int main(){
int n,p;
while(~scanf("%d%d",&n,&p)){
if(n==0&&p==0) break;
long long ans=1;
for(int i=2;i<=n;i++){
ans*=i%p;
ans%=p;
}
printf("%d\n",ans%p);
}
return 0;
}
URAL 1528 Sequence,布布扣,bubuko.com
标签:des style http color os strong io width
原文地址:http://blog.csdn.net/kimi_r_17/article/details/38088087