当前位置: 首页 > news >正文

AT_fps_24_b 整数の組

生成函数是简单的,列出生成函数 然后对后两个的分母因式分解发现能和前两项消掉,最后是 \([x^n]\frac{1}{(x-1)^2}\)

还有一种是枚举前两种,然后 \(d\)\(t=n-a-b\) 模 2 同余,且满足 \(3d\le t\) 所以看 \(\lfloor\frac{t}{3}\rfloor\) 中有多少个数与 \(t\) 同余。

还有一种比较高妙是 \(a,c\) 配对 \(b,d\) 配对,当 \(a+c\) 取得某值时 \(a,c\) 对应的方案唯一,\(b,d\) 同理。而 \(a+b+c+d=n\) 所以确定了 \(a+c\) 就相当于确定了 \(a,b,c,d\),而 \(a+c\in[0,n]\),所以一共有 \(n+1\) 种。

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define fin(x) freopen(#x".in","r",stdin)
#define fout(x) freopen(#x".out","w",stdout)
#define fr(x) fin(x),fout(x);
#define Fr(x,y) fin(x),fout(y)
#define INPUT(_1,_2,FILE,...) FILE
#define IO(...) INPUT(__VA_ARGS__,Fr,fr)(__VA_ARGS__)
using namespace std;
using namespace __gnu_pbds;
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define cfast ios::sync_with_stdio(false);cin.tie(0),cout.tie(0)
#define ll long long
#define ull unsigned long long
#define intz(x,y) memset((x),(y),sizeof((x)))
char *p1,*p2,buf[100000];
#define nc() (p1==p2 && (p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
#define tup(x) array<int,(x)>
inline ll read(){ll x=0,f=1;char ch=nc();while(ch<48||ch>57){if(ch=='-')f=-1;ch=nc();}while(ch>=48&&ch<=57)x=x*10+ch-48,ch=nc();return x*f;
}
//void write(int x){cout<<x<<' ';}
//void write(pii x){cout<<"P("<<x.fi<<','<<x.se<<")\n";}
//void write(vector<auto>x){for(auto i:x)write(i);cout<<'\n';}
//void write(auto *a,int l,int r){for(int i=l;i<=r;i++)write(a[i]);cout<<'\n';}
inline ll lowbit(ll x){return x&-x;}
inline int pcount(ll x){for(int i=0,res=0;;res+=(x>>i)&1,i++)if(i>60)return res;
}//struct mt{
//	ll v;
//	mt(){v=0;}
//	mt(int x){this->v=x;}
//	inline mt operator+(mt x){return {(v+x.v)%mod};}
//	inline mt operator-(mt x){return {(v+mod-x.v)%mod};}
//	inline mt operator*(mt x){return {1ll*v*x.v%mod};}
//};
//inline void add(mt &x,mt y){x=x+y;}
//mt qp(mt x,int y){mt res(1);for(;y;x=x*x,y>>=1)if(y&1)res=res*x;return res;}
const int mod=998244353;
inline void UesugiErii(){int n;ll ans=0;cin>>n;for(int a:{0,1})for(int b:{0,1,2}){int tmp=n-a-b;if(tmp<0)break;if(tmp&1)(ans+=((tmp/3)&1?(tmp/3+2)/2:(tmp/3+1)/2)%mod)%=mod;else (ans+=((tmp/3)&1?(tmp/3+1)/2:(tmp/3+2)/2)%mod)%=mod;}cout<<ans;
}
signed main(){//IO();//cfast;int _=1;//cin>>_;for(;_;_--)UesugiErii();return 0;
}
http://www.jsqmd.com/news/53234/

相关文章:

  • 详细介绍:【数据结构初阶】单链表
  • 第五十篇
  • 每日随笔
  • 2025年日语自学软件推荐:最适合零基础与进阶者的优质口碑选择
  • ABC386 VP总结
  • tarjan 强连通分量、缩点、点双、割点、割边(桥)
  • 我踩坑后总结:企业微信客服API接入客服系统,90%的人都搞错了!
  • 香橙派上进行MQTT数据存储客户端开发(一)基本环境配置
  • GEO 优化价格大比拼,哪家最便宜?三大高性价比机构推荐
  • 2025年AI学习机哪个品牌好?热门品牌功能与效果全解析
  • 2025年知名的长租公寓有哪些:权威榜单与精选解析
  • 编程中的枚举法与数学上的穷举法有何区别?
  • 如百钱百鸡问题,枚举法和穷举法有何不同
  • 根本魔法语言数组 (一) (C语言)
  • 《程序员修炼之道:从小工到专家》阅读笔记5
  • Spring Cloud工程中使用Nacos配置中心的2种方式
  • 人工智能之数据分析 Matplotlib:第三章 基本属性
  • 那为什么go 就能用同步的写法,而且不用协程的情况下,实现异步编程,而且还不阻塞os线程
  • URL地址转base64
  • 2025年租房去哪里找房源:独家榜单与深度解析
  • C# 图片加载引发的内存溢出异常
  • 实用指南:LV.5 文件IO
  • CSS视图过渡入门指南:让多页面应用拥有丝滑动画
  • 《ROS1学习笔记8——自定义服务素材》
  • 实用指南:逻辑回归(Logistic Regression)
  • CTIP 与 3D-IC 堆栈热行为仿真实践
  • Mac 安装 4K Video Downloader v5.0.0.5303-1.dmg 方法(附安装包)
  • 浮点数定点表示(Q格式)
  • TPS的另外一层含义:绝对并发用户数 - BKY007
  • P10547 [THUPC 2024 决赛] 排列游戏