潮州建设网站,wordpress主题恢复默认密码,vs2015 asp网站开发,网站搭建 成都A - Petya and Origami CodeForces - 1080A 题意#xff1a;制造一份邀请函需要2份a物品#xff0c;5份b物品#xff0c;8份c物品#xff0c;一个盒子里面有k份物品#xff08;可以为a或b或c#xff09;问你制造n份邀请函需要用多少个盒子 题解#xff1a;加起来就行了…A - Petya and Origami CodeForces - 1080A 题意制造一份邀请函需要2份a物品5份b物品8份c物品一个盒子里面有k份物品可以为a或b或c问你制造n份邀请函需要用多少个盒子 题解加起来就行了 #include iostream
#include cstdio
#include cmath
#include cstring
#include algorithm
#include vector
#include queue
#include set
#include map
#includestack
#define INF 0x3f3f3f3f
#define lowbit(x) (x(-x))
using namespace std;
typedef long long ll;const int maxn 4e4 10;
const int mod 1e9 7;int main()
{int n,k;cin n k;int sum 0;sum ceil(2.0 * n / (k * 1.0));sum ceil(5.0 * n / (k * 1.0));sum ceil(8.0 * n / (k * 1.0));cout sum endl;
} View Code B - Margarite and the best present CodeForces - 1080B 题意区间内偶数和减去奇数和 题解分类一下就好了 #include iostream
#include cstdio
#include cmath
#include cstring
#include algorithm
#include vector
#include queue
#include set
#include map
#includestack
#define INF 0x3f3f3f3f
#define lowbit(x) (x(-x))
using namespace std;
typedef long long ll;const int maxn 4e4 10;
const int mod 1e9 7;int main()
{int t;cin t;while (t--){ll l, r;cin l r;ll ans;if (l r){if (l % 2 0)ans l;elseans -1 * l;}else{if (l % 2 1 r % 2 1)ans (r - l) / 2 - r;else if (l % 2 1 r % 2 0)ans (r - l 1) / 2;else if (l % 2 0 r % 2 0)ans -1*(r - l) / 2 r;elseans ((r - l 1) / 2) * (-1);}cout ans endl;}} View Code C - Masha and two friends CodeForces - 1080C 题意给你一个n行m列的黑白块相间的棋盘进行两次操作第一次把x1,y1到x2,y2的区域全部涂白第二次把x3,y3)到x4,y4)的区域全部涂黑问你这样以后黑白各有多少块 题解分割矩形判断矩形的左下角的点是黑色还是白色就好了 #include iostream
#include cstdio
#include cmath
#include cstring
#include algorithm
#include vector
#include queue
#include set
#include map
#includestack
#define INF 0x3f3f3f3f
#define lowbit(x) (x(-x))
using namespace std;
typedef long long LL;const int maxn 4e4 10;
const int mod 1e9 7;LL n,m,black,white;
int X1,X2,X3,X4,Y1,Y2,Y3,Y4;void jishu(LL lx,LL ly,LL rx,LL ry,bool flag) {LL N ry - ly 1, M rx - lx 1, b, w;LL tmp N * M / 2;LL res N * M - tmp;if((lx ly) % 2) {w tmp;b res;}else {b tmp;w res;}if(flag) {white b;black - b;}else {black w;white - w;}
}void cut(LL x1,LL y1,LL x2,LL y2)
{if(x1 x2 || y1 y2)return;if(x2X3 || y2Y3 || x1X4 || y1Y4){jishu(x1,y1,x2,y2,1);return;}if(x1X3) {cut(x1, y1, X3 - 1, y2);x1 X3;}if(x2X4) {cut(X4 1, y1, x2, y2);x2 X4;}if(y1Y3) {cut(x1, y1, x2, Y3 - 1);y1 Y3;}if(y2Y4) {cut(x1, Y4 1, x2, y2);y2 Y4;}
}
int main()
{int t;cin t;while(t--){cin n m;cin X1 Y1 X2 Y2;cin X3 Y3 X4 Y4;black n * m / 2;white n * m - black;cut(X1,Y1,X2,Y2);jishu(X3,Y3,X4,Y4,0);printf(%lld %lld\n,white,black);}
} View Code D - Olya and magical square CodeForces - 1080D 题意有一个初始时宽为 2n的正方形你每次可以对一个完整的正方形进行四等分。问是否存在一种方案使得在恰好四等分 k次之后存在一条等宽的路径使得左下角的方块和右上角的方块联通四联通如果这种方案存在输出路径的宽度对2取对数的值。 题解n大于31的话只需要切右下角的一块就可以了那么答案就是n -1n小于等于31的时候枚举答案即可 #includeiostream
#includecstdio
#includealgorithm
#includecmath
#includevector
#includequeue
#includestring.h
#includecstring
using namespace std;
#define LL long long
const int MAXN 1e3 10;
const int INF 0x3f3f3f3f;
const int mod 1e9 7;LL tot[40];
int main()
{LL n,k,t;LL cur 1;for(int i 0; i 31; i,cur * 4){tot[i] (cur - 1) / 3;}cin t;while(t--){cin n k;if (n 31)printf(YES %lld\n, n - 1);else{int ans -1;for(int i 0; i n; i){LL tmp n - i,need (1LL tmp 1) - tmp - 2;if(need k){LL last tot[n] - ((1LL tmp 1) - 1) * tot[i];if(last k){ans i;break;}}}if(~ans)printf(YES %d\n,ans);elseputs(NO);}}
} View Code E - Sonya and Matrix Beauty CodeForces - 1080E 转载于:https://www.cnblogs.com/smallhester/p/11178090.html