网站建设的前期工作基础win7网站建设
news/
2025/9/23 4:18:18/
文章来源:
网站建设的前期工作基础,win7网站建设,有限公司注册资金最低多少,网站建设代理开发科技企业服务“楼下一个男人病得要死#xff0c;那间隔壁的一家唱着留声机#xff0c;对面是弄孩子。楼上有两人狂笑#xff1b;还有打牌声。河中的船上有女人哭着她死去的母亲。人类的悲欢并不相通#xff0c;我只觉得他们吵闹。”
A - XORwice
把a和b看成二进制数处理#xff0c;不…“楼下一个男人病得要死那间隔壁的一家唱着留声机对面是弄孩子。楼上有两人狂笑还有打牌声。河中的船上有女人哭着她死去的母亲。人类的悲欢并不相通我只觉得他们吵闹。”
A - XORwice
把a和b看成二进制数处理不难发现只要ab某位都是1我们就有办法把它消掉否则答案该位一定是ab01该位的值
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#includeset
#includemap
#includecmath
#includequeue
#includestring
#includevector
#includecstdio
#includecstring
#includeiostream
#includealgorithm
#includeunordered_map
using namespace std;
typedef long long ll;
typedef pairint,int pii;
int main()
{IO;int T1;cinT;while(T--){int a,b;cinab;int res0;for(int i30;i0;i--)if(!(ai1)(bi1)||(ai1)!(bi1)) res1i;coutres\n;}return 0;
}
B - Putting Bricks in the Wall
我们只要让g[1][2]和g[2][1]的值相等并且不等于g[n][n-1]和g[n-1][n]的值即可最多操作3步。
懒得想了直接枚举(24162^4162416)应该有更好写的写法。
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#includeset
#includemap
#includecmath
#includequeue
#includestring
#includevector
#includecstdio
#includecstring
#includeiostream
#includealgorithm
#includeunordered_map
using namespace std;
typedef long long ll;
typedef pairint,int pii;
const int N210;
char g[N][N];
int main()
{IO;int T1;cinT;while(T--){int n;cinn;for(int i1;in;i) cing[i]1;if(g[1][2]0g[2][1]0g[n][n-1]0g[n-1][n]0) cout2\n1 2\n2 1\n;else if(g[1][2]1g[2][1]0g[n][n-1]0g[n-1][n]0)cout1\n2 1\n;else if(g[1][2]0g[2][1]1g[n][n-1]0g[n-1][n]0)cout1\n1 2\n;else if(g[1][2]1g[2][1]1g[n][n-1]0g[n-1][n]0)cout0\n;else if(g[1][2]0g[2][1]0g[n][n-1]1g[n-1][n]0)cout1\nn-1 n\n;else if(g[1][2]1g[2][1]0g[n][n-1]1g[n-1][n]0)cout2\n2 1\nn n-1\n;else if(g[1][2]0g[2][1]1g[n][n-1]1g[n-1][n]0)cout2\n2 1\nn n-1\n;else if(g[1][2]1g[2][1]1g[n][n-1]1g[n-1][n]0)cout1\nn n-1\n;else if(g[1][2]0g[2][1]0g[n][n-1]0g[n-1][n]1)cout1\nn n-1\n;else if(g[1][2]1g[2][1]0g[n][n-1]0g[n-1][n]1)cout2\n1 2\nn n-1\n;else if(g[1][2]0g[2][1]1g[n][n-1]0g[n-1][n]1)cout2\n1 2\nn-1 n\n;else if(g[1][2]1g[2][1]1g[n][n-1]0g[n-1][n]1)cout1\nn-1 n\n;else if(g[1][2]0g[2][1]0g[n][n-1]1g[n-1][n]1)cout0\n;else if(g[1][2]1g[2][1]0g[n][n-1]1g[n-1][n]1)cout1\n1 2\n;else if(g[1][2]0g[2][1]1g[n][n-1]1g[n-1][n]1)cout1\n2 1\n;else cout2\n1 2\n2 1\n;}return 0;C - Palindromifier
abcdef→(edcb)abcdef→edcbabcdef(edcba)→edcbabcdefedcba(bcde)abcdef \to (edcb)abcdef\to edcbabcdef(edcba)\to edcbabcdefedcba(bcde)abcdef→(edcb)abcdef→edcbabcdef(edcba)→edcbabcdefedcba(bcde) 只要三步直接搞出来可以配合代码和上述例子食用
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#includeset
#includemap
#includecmath
#includequeue
#includestring
#includevector
#includecstdio
#includecstring
#includeiostream
#includealgorithm
#includeunordered_map
using namespace std;
typedef long long ll;
typedef pairint,int pii;
int main()
{IO;int T1;//cinT;while(T--){string s;cins;int ns.size();cout3\n;coutL n-1\n;coutR n-1\n;coutR 2*n-1\n;}return 0;}
D - Hexagons
六个方向分别让坐标的变化 c1:(x1,y1)c_1:(x1,y1)c1:(x1,y1) c2:(x,y1)c_2:(x,y1)c2:(x,y1) c3:(x−1,y)c_3:(x-1,y)c3:(x−1,y) c4:(x−1,y−1)c_4:(x-1,y-1)c4:(x−1,y−1) c5:(x,y−1)c_5:(x,y-1)c5:(x,y−1) c6:(x1,y)c_6:(x1,y)c6:(x1,y)
不难发现操作c2c6c1c_2c_6c_1c2c6c1、c3c5c4c_3c_5c_4c3c5c4 因此从两方面考虑是否使用c1c_1c1和c4c_4c4操作 如果不使用那么只通过单独进行横坐标±1和纵坐标±1到达目的地直接算即可。 如果使用那么首先使得最终向x坐标和向y坐标移动的步数dxdy相等于是考虑先通过横坐标±1或者纵坐标±1操作使最终dxdy然后再通过c1c_1c1或者c4c_4c4操作使之到达目的地。 不过注意等效操作c2c6c1c_2c_6c_1c2c6c1、c3c5c4c_3c_5c_4c3c5c4取代价更小的。
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#includeset
#includemap
#includecmath
#includequeue
#includestring
#includevector
#includecstdio
#includecstring
#includeiostream
#includealgorithm
#includeunordered_map
using namespace std;
typedef long long ll;
typedef pairint,int pii;
ll c[10];
int main()
{IO;int T1;cinT;while(T--){ll x,y;cinxy;for(int i1;i6;i) cinc[i];ll res8e18;ll now0;// x 6// -x 3// y 2// -y 5// 不用c1和c4if(x0y0)nowc[6]*xc[2]*y;else if(x0y0)nowc[6]*xc[5]*(-y);else if(x0y0)nowc[3]*(-x)c[2]*y;elsenowc[3]*(-x)c[5]*(-y);resmin(res,now);// 使用c1和c4if(xy){now0;nowc[5]*(x-y);if(x0) nowmin(c[1],c[2]c[6])*x;else nowmin(c[4],c[3]c[5])*(-x);resmin(res,now);now0;nowc[6]*(x-y);if(y0) nowmin(c[1],c[2]c[6])*y;else nowmin(c[4],c[3]c[5])*(-y);resmin(res,now);}else{now0;nowc[3]*(y-x);if(y0) nowmin(c[1],c[2]c[6])*y;else nowmin(c[4],c[3]c[5])*(-y);resmin(res,now);now0;nowc[2]*(y-x);if(x0) nowmin(c[1],c[2]c[6])*x;else nowmin(c[4],c[3]c[5])*(-x);resmin(res,now);}coutres\n;}return 0;
}吐槽一波这题debug了半天竟然是上限搞小了自己一般开101810^{18}1018结果有数据的答案比该值还大最终把最大值开到8×10188×10^{18}8×1018才过的。。。
刚刚看了一波别人的题解发现D题只需要把所有等效操作的代价取个最小值即可没必要这样讨论嗨自己还是太菜了
E - Swedish Heroes
这题好像是dp以后回补的
最近学业压力有点重而且快期中考试了。。。这周六还有校赛希望能打出好成绩。
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/911334.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!