标签:
1 2 3
6 30 90
好像挺直接的一个题目,不知道比赛的时候为什么那么捉急。
#include <iostream> #include <stdio.h> #include <string> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; const int mod = 9999; char s[10009]; ll num[11009]; ll fun(ll x) { return x*(x+1)*(x+2); } void init() { memset(num,0,sizeof num); for(int i=1;i<=10009;i++) { num[i]=(num[i-1]+fun(i))%mod; } } int main() { init(); while(~scanf("%s",s)) { int len=strlen(s); ll ans=0; for(int i=0;i<len;i++) ans=(ans*10+(s[i]-'0'))%mod; printf("%I64d\n",num[ans]); } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/wust_zjx/article/details/48115003