VK Cup 2016 - Round 1 (Div. 2 Edition) A. Bear and Reverse Radewoosh

题意:给你每道题的分数和AC需要的时间,给每分钟每道题掉分C,一个人正着做题,一个人倒着做题,问谁分高
思路:就跟着题目做吧..

#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define lowbit(x) (x&(-x))
typedef long long LL;
#define maxn 10005
const int inf=(1<<28)-1;
int p[maxn],t[maxn];
int main()
{
    int n,c;
    scanf("%d%d",&n,&c);
    for(int i=1;i<=n;++i)
    scanf("%d",&p[i]);
    for(int i=1;i<=n;++i)
    scanf("%d",&t[i]);
    int Time=0,tot1=0,tot2=0;
    for(int i=1;i<=n;++i)
    {
        Time+=t[i];
        tot1+=max(0,p[i]-Time*c);
    }
    Time=0;
    for(int i=n;i>=1;--i)
    {
        Time+=t[i];
        tot2+=max(0,p[i]-Time*c);
    }
    if(tot2<tot1) printf("Limak\n");
    else if(tot2>tot1) printf("Radewoosh\n");
    else printf("Tie\n");
    return 0;
}

你可能感兴趣的:(codeforces)