最近比较懒,写了俩题就跑了
A - Ice Tea Store
简化背包
#include<cstdio> #include<algorithm> using namespace std; long long a,b,c,d,A,B,C,D,n,m; long long min(long long a,long long b){return a<b?a:b;} int main(){ scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&n);n*=4; A=a*8;B=b*4;C=c*2;D=d; if (A>B) A=B; if (A>C) A=C; if (A>D) A=D; printf("%lld ",n/8*A+(n%8==4?min(a*4,min(c,min(a*2+b,b*2))):0)); }
B - Reverse and Compare
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> #include <map> using namespace std; const int N = 2000010; char s[N], str[N*2]; int p[N*2],a[N]; long long manacher() { int i; for(i = 1; s[i]; i++) str[i*2] = s[i], str[i*2+1] = '#'; str[0] = '?', str[1] = '#', str[i*2] = '