### Code

#include
#define maxn 505
#define ll long long
using namespace std;
const int mo=1e9+7;
int n,m,a[maxn],b[maxn],c[maxn],z[maxn],A[maxn],B[maxn];
ll K;
void inc(int &x,int y){x=((x+y>=mo)?x+y-mo:x+y);}
void dec(int &x,int y){x=((x-y<0)?x-y+mo:x-y);}
void mult(int *u,int *v){
int i,j;
memset(z,0,sizeof(z));
for(i=0;i<250;i++)
for(j=0;j<250;j++)
z[i+j]=(z[i+j]+1LL*u[i]*v[j])%mo;
for(i=498;i>=250;i--)
for(j=1;j<=m;j++)
inc(z[i-b[j]],z[i]);
for(i=0;i<250;i++) u[i]=z[i];
}
void fpm(int *c,ll n){
memset(A,0,sizeof(A));
A[0]=1;
while(n){
if(n&1) mult(A,c);
n>>=1,mult(c,c);
}
}
int main(){
int i,j;
scanf("%d %d %lld",&n,&m,&K);
for(i=1;i<=n;i++) scanf("%d",&a[i]);
for(i=1;i<=m;i++) scanf("%d",&b[i]);
for(i=1;i<=n;i++){
memset(c,0,sizeof(c));
c[1]=1,fpm(c,a[i]);
for(j=0;j<250;j++) inc(B[j],A[j]);
}
fpm(B,K);
for(i=0;i<250;i++) B[i]=A[i];
for(i=249;i>0;i--)
for(j=1;j<=m;j++)
if(i>=b[j]) inc(B[i-b[j]],B[i]);
cout<
 
 Share 【LeetCode 218】The Skyline Problem / 题解 Origin [https://leetcode.com/problems/the-skyline-problem/] Statement 你要设计一个程序去帮助一个建筑师绘制在城市里特定区域建筑的轮廓线。为了使问题易于处理，所有的建筑的外形都是矩形的，且它们共享同一个地面（这个城市建设在同一个非常平坦的地面上）… 10 Jul 2018 【CodeVS 2845】排序的代价（sort）/ 题解 Origin [http://codevs.cn/problem/2845/] Statement There is a list of… 09 Jul 2018 
 
 
 Zepto's © 2024 Data & privacy Contact → Published with Ghost • Theme Attila • System theme 
 $(document).ready(function () { var viewport =$(window); var post = $('.post-content'); // Responsive videos with fitVids post.fitVids(); // Format code blocks and add line numbers function codestyling() {$('pre code').each(function(i, e) { // Code highlight hljs.highlightElement(e); // No lines for plain text blocks if (!$(this).hasClass('language-text')) { var code =$(this); // Calculate amount of lines var lines = code.html().split(/\n(?!$)/g).length; var numbers = []; if (lines > 1) { lines++; } for (i = 1; i < lines; i++) { numbers += '<span class="line" aria-hidden="true">' + i + '</span>'; } code.parent().append('<div class="lines">' + numbers + '</div>'); } }); } codestyling(); // Reading progress bar on window top function readingProgress() { var postBottom = post.offset().top + post.height(); var viewportHeight = viewport.height(); var progress = 100 - (((postBottom - (viewport.scrollTop() + viewportHeight) + viewportHeight / 3) / (postBottom - viewportHeight + viewportHeight / 3)) * 100);$('.progress-bar').css('width', progress + '%'); (progress > 100) ? $('.progress-container').addClass('complete'):$('.progress-container').removeClass('complete'); } readingProgress(); // Trigger reading progress viewport.on({ 'scroll': function() { readingProgress(); }, 'resize': function() { readingProgress(); }, 'orientationchange': function() { readingProgress(); } }); });