标签:family opened div close margin its main line 5.5
神仙题预警,,,
我真滴觉得还是挺难的了,,,先存下还没完成的代码QAQ
咕咕咕
下午写趴QAQ
#include<bits/stdc++.h> using namespace std; #define ll long long #define rp(i,x,y) for(register ll i=x;i<=y;++i) ll f[6][6][6][6][6]; inline ll read() { register char ch=getchar();register ll x=0;register bool y=1; while(ch!=‘-‘ && (ch>‘9‘ || ch<‘0‘))ch=getchar(); if(ch==‘-‘)ch=getchar(),y=0; while(ch>=‘0‘ && ch<=‘9‘)x=(x<<1)+(x<<3)+(ch^‘0‘),ch=getchar(); return y?x:-x; } inline void dfs(ll x,ll y,ll z,ll p,ll q) { if(f[x][y][z][p][q])return f[x][y][z][p][q]; if(x<5)f[x][y][z][p][q]+=dfs(x+1,y,z,p,q); if(y<5 && y<x)f[x][y][z][p][q]+=dfs(x,y+1,z,p,q); if(z<5 && z<y)f[x][y][z][p][q]+=dfs(x,y,z+1,p,q); if(p<5 && p<z)f[x][y][z][p][q]+=dfs(x,y,z,p+1,q); if(q<5 && q<p)f[x][y][z][p][q]+=dfs(x,y,z,p,q+1); return f[x][y][z][p][1]; } inline void wk1() { string s;cin>>s; tybj; } inline void wk2() { ll k=read(); rp(i,1,25) { csbj; } } int main() { f[5][5][5][5][4]=1; dfs(1,0,0,0,0); char ch;cin>>ch;if(ch==‘W‘)wk1();else wk2(); return 0; } //欧克预处理我get了 //然而逼近我好像依然不是很会实现QAQ //等下写趴!over!
P2750 贰五语言Two Five USACO5.5 记忆化搜索
标签:family opened div close margin its main line 5.5
原文地址:https://www.cnblogs.com/lqsukida/p/10313668.html