hdu 多校賽 第八場

2021-09-26 08:16:58 字數 3771 閱讀 9793

首先確定答案不會太大,寫個狀壓跑一跑,能跑出所有答案(或者直接oeis)

#include #define ll long long

#define sc scanf

#define pr printf

using namespace std;

ll a1[84] = ;

ll a2[14] = ;

ll a3[36] = ;

ll a4[48] = ;

ll a5[5] = ;

ll a6[72] = ;

ll a7[49] = ;

ll a8[344] = ;

ll a9[9] = ;

int main()}}

else if (d == 2)}}

else if (d == 3)}}

else if (d == 4)}}

else if (d == 5)}}

else if (d == 6)}}

else if (d == 7)}}

else if (d == 8)}}

else if (d == 9)}}

qwe:;

}}

有兩個正方形,問你將這個平面分為了幾塊不連通的區域。

先離散化,然後暴力每條邊會產生的不連通區域,然後跑dfs連通塊。

#include #define ll long long

#define sc scanf

#define pr printf

using namespace std;

struct point

}a[4], b[4];

ll x[10];

ll y[10];

int s[30][30];

bool vis[30];

void calc(point q, point w)

else if (w.y == 2)

else if (w.y == 3)

else if (w.y == 4)

}else if (q.y == 2)

else if (w.y == 3)

else if (w.y == 4)

}else if (q.y == 3)

else if (w.y == 4)}}

else

else if (w.x == 2)

else if (w.x == 3)

else if (w.x == 4)

}else if (q.x == 2)

else if (w.x == 3)

else if (w.x == 4)

}else if (q.x == 3)

else if (w.x == 4)}}

}void dfs(int index)

}}int main()

for (int i = 1; i <= 25; i++)

if (i % 5 != 1)

}/*for (int i = 1; i <= 25; i++)

for (int j = 1; j <= 25; j++)

printf("%d%c", s[i][j], j == 25 ? '\n' : ' ');*/

sc("%lld%lld%lld%lld", &a[0].x, &a[0].y, &a[2].x, &a[2].y);

sc("%lld%lld%lld%lld", &b[0].x, &b[0].y, &b[2].x, &b[2].y);

x[0] = a[0].x; x[1] = a[2].x; x[2] = b[0].x; x[3] = b[2].x;

y[0] = a[0].y; y[1] = a[2].y; y[2] = b[0].y; y[3] = b[2].y;

sort(x, x + 4);

a[0].x = lower_bound(x, x + 4, a[0].x) - x + 1;

a[2].x = lower_bound(x, x + 4, a[2].x) - x + 1;

b[0].x = lower_bound(x, x + 4, b[0].x) - x + 1;

b[2].x = lower_bound(x, x + 4, b[2].x) - x + 1;

sort(y, y + 4);

a[0].y = lower_bound(y, y + 4, a[0].y) - y + 1;

a[2].y = lower_bound(y, y + 4, a[2].y) - y + 1;

b[0].y = lower_bound(y, y + 4, b[0].y) - y + 1;

b[2].y = lower_bound(y, y + 4, b[2].y) - y + 1;

// a[0].print();

// a[2].print();

// b[0].print();

// b[2].print();

a[1] = point;

a[3] = point;

b[1] = point;

b[3] = point;

for (int i = 0; i < 4; i++)

/*for (int i = 1; i <= 25; i++)

for (int j = 1; j <= 25; j++)

printf("%d%c", s[i][j], j == 25 ? '\n' : ' ');*/

memset(vis, false, sizeof(vis));

int color = 0;

for (int i = 1; i <= 25; ++i)

}printf("%d\n", color);

}}

簽到

#include #define ll long long

#define sc scanf

#define pr printf

#define lson left,mid,k<<1

#define rson mid+1,right,k<<1|1

#define imid int mid=(left+right)/2;

using namespace std;

const int maxn = 1e5 + 5;

struct node

que[100005];

int main()

); ll qq = (ll)n * d;

if (qq % 10 != 5)

pr("quailty is very great\n");

else

}}

有 n 個班,每個班的人數和茶都不相同,每個班的人不能喝自己班的茶,問最多有多少個人能喝茶

貪心,列舉班,這個班不喝自己的茶的能喝的最大的。

#includeusing namespace std;

#define ll long long

#define sc scanf

#define pr printf

const int n =1e6 + 10;

ll a[n], b[n];

int main()

ll ans = 0;

for (int i = 1; i <= n; i++)

printf("%lld\n", ans);

}}

多校第八場

hdu 4950 monster 小模擬題,找到判斷的臨界條件 include include includeusing namespace std int64 h,a,b,k,sum int main int i 0 while scanf i64d i64d i64d i64d h,a,b,k ...

多校第八場

hdu 4950 monster 小模擬題。找到推斷的臨界條件。include include includeusing namespace std int64 h,a,b,k,sum int main int i 0 while scanf i64d i64d i64d i64d h,a,b,k ...

2019 牛客 多校賽 第八場

乙個區間的貢獻為這個區間的不同數字的個數,求所有子區間的貢獻和 反向思考,計算乙個數字在子區間 現的次數,當區間的左端點在這個數字上一次出現位置和當前位置之間,並且右端點在當前位置之後,這個數字都產生了貢獻,所以當前位置的數字的貢獻就是左端點數量 右端點數量,然後遍歷一遍。include defin...