url
這次題是最難的一次吧
b 《挑戰》上的原題(差不多
複雜度 o(
n⋅logn)
#include
#include
#include
#include
#include
#include
#include
using
namespace
std;
typedef
long
long ll;
const
double eps = 1e-8;
const
int inf = 0x3f3f3f3f;
const
int maxn = (int)(5e4) + 5;
int n, p;
int a[maxn], b[maxn];
void slove()
tank += que.top();
que.pop();
++ans;
}tank -= d;
que.push(b[i]);
}printf("%d\n", ans);
}int main()
for(int i = 0; i < n; ++i)
slove();
}return
0;}
c
複雜度 θ(
n)
#include
#include
#include
#include
#include
#include
#include
using
namespace
std;
typedef
long
long ll;
const
double eps = 1e-8;
const
int inf = 0x3f3f3f3f;
char s[10005];
int cnt[260];
int main()
int mod = 0;
for(int i = 0; i < 260; ++i)
for(int i = 1; s[i]; ++i)
printf("%d\n", ans);
}return
0;}
d
複雜度 θ(
1)
#include
#include
#include
#include
#include
#include
#include
using
namespace
std;
typedef
long
long ll;
const
double eps = 1e-8;
const
int inf = 0x3f3f3f3f;
const
double pi = acos((double)(-1.0));
int main()
double a = (r * r - r * r * 2.0) / (r * r);
a = acos(a);
printf("%.0lf\n", ceil(pi * 4.0 / a));
}return
0;}
f
複雜度 θ(
1)
#include
#include
#include
#include
#include
#include
#include
using
namespace
std;
typedef
long
long ll;
const
double eps = 1e-8;
const
int inf = 0x3f3f3f3f;
int main()
n -= a;
n %= a + b;
puts(n < a ? "no" : "yes");
}return
0;}
g
初看題,心想什麼鬼?直接跳過,最後看有人過了,也重新看了下題,發現三塊只能拼成一種單位矩形—— 4 × 8的,這樣就是老問題了。
輪廓線dp或直接狀壓dp都是可以的,可以檢視下面這篇文章,(其實也是參考《挑戰》的
輪廓線dp複雜度 θ(
n⋅24
+logn)
#include
#include
#include
#include
#include
#include
#include
using
namespace
std;
typedef
long
long ll;
int dp[2][1
<<4];
const
int mod = 1000000007;
int modpow(int a, int n)
return res;
}int main()
int m = n / 4;
memset(dp, 0, sizeof(dp));
int *crt = dp[0], *next = dp[1];
crt[0] = 1;
for(int i = m - 1; ~i; --i)
next[s] = crt[s|(1
< 4 && !(s>>(j + 1)&1))
}swap(crt, next);}}
int ans = 1ll * crt[0] * modpow(2, n) % mod;
printf("%d\n", ans);
}return
0;}
i
xjb寫就行了,複雜度 θ(
125)
#include
#include
#include
#include
#include
#include
#include
using
namespace
std;
const
int inf = 0x3f3f3f3f;
int best;
struct nodes;
void dfs(int now, node ste)
if(flag && best > now) best = now;
node tmp = ste;
for(int k = 0; k < 3; ++k)
for(int i = 1; i <= 2; ++i)
}}int main()
return
0;}
其他的題有時間再補————————— 2013多校第六場
hdu 4655 題意 給乙個序列,每個位置可以塗1 ai種顏色,連續不相同的顏色為一段,對於乙個排列,所有的塗色方法產生的段數為s,求最大的s 分析 對於乙個排序,所有的段數為n 相鄰兩個位置塗相同顏色的個數s 怎麼計算相鄰兩個位置塗相同顏色的個數s?p i 表示字首積,即p i a1 a2 ai...
杭電多校第六場(IF)
題意 有命題 將 b 進製數y按位相加,迴圈無窮次,最終結果若 x 0,則有y x 0,反之不然 給出b和x,判斷命題是否成立 打表發現的b x 1時成立,看到有數論大佬推出來的 想看推導的右轉 includeusing namespace std typedef unsigned long lon...
HDU 多校聯合第六場
uestc的題。果然,題意都弄得這麼晦澀。推個規律,mod r。偶推錯了。1個小時才過。三分做的。還是不知道怎麼證明他是凹函式,話說。以為神人想當然的說這是凹函式。怎麼證明?管他呢,真沒勁!話說偶已經推出來s1的和sum1,s2的和sum2。sum1 sum2必為偶數,才能yes。但是對於字串長度為...