HDU--1028 Ignatius and the Princess III
来源:互联网 发布:网络金融营销模式 编辑:程序博客网 时间:2024/05/18 01:21
#include<cstdio>#include<cstring>#include<string>#include<iostream>#include<cmath>#include<algorithm>using namespace std;typedef long long LL;const LL MAXN = 120 ;int F[MAXN+1];int P[MAXN+1] ;void Prepare() { LL i , j , k , s , o ; P[0] = 1 ; for ( i = 1 ; i <= MAXN ; i ++ ) { j = 1 , k = 1 , s = 0 , o = -1 ; for ( ; j > 0 ; k ++ , o *= -1 ) { j = i - (3*k*k+k)/2 ; if ( j >= 0 ) s -= o * P[j] ; j = i - (3*k*k-k)/2 ; if ( j >= 0 ) s -= o * P[j] ; } P[i] = s ; }}int main() { Prepare() ; int Test , N ; while ( cin>>N ) { printf("%d\n",P[N]); }}
怎么说呢。看到这道题就想到了昨天多校的1009............一看还真就一样。
还是打表题,因为昨天多校是2KMS而,今天是1KMS。
所以还是把,MAXN的值从10000降到了125,足够了
简单来说是一个母函数的题,大致就是循环递推的过程。
- hdu 1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- HDU-1028-Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- HDU--1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- Ignatius and the Princess III hdu 1028
- ORA-12162: TNS:net service name is incorrectly specified
- poj 1222 EXTENDED LIGHTS OUT高斯消元。
- boost serialization
- find -type 类型
- ipad 设备越狱和反越狱
- HDU--1028 Ignatius and the Princess III
- uva 11990(动态逆序对)
- C++中使用boost::serialization库――应用篇
- 风雨20年:我所积累的20条编程经验
- 第1章 入门
- 判断当前的navigationController的viewControllers的数量
- 4.2android系统刷机
- 在pcDuino上使用蓝牙耳机玩转音乐
- 5个代码搜索引擎