【CodeForces】[658A]Bear and Reverse Radewoosh

Problem Description

Loading...

Problem Analysis

Compute each player’s score according to the statement
and then just compare them.

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<stdio.h>
int main() {
	int n,c;
	while(scanf("%d %d",&n,&c)!=EOF) {
		int a[55],q[55];
		for(int i=0; i<n; i++)
			scanf("%d",&a[i]);
		for(int i=0; i<n; i++)
			scanf("%d",&q[i]);
		int sum1=0,sum2=0;
		int tq=0;
		for(int i=0; i<n; i++) {
			tq+=q[i];
			int t=a[i]-c*tq;
			if(t>0)
				sum1+=t;
		}
		tq=0;
		for(int i=n-1; i>=0; i--) {
			tq+=q[i];
			int t=a[i]-c*tq;
			if(t>0)
				sum2+=t;
		}
		if(sum1>sum2)
			printf("Limak\n");
		else if(sum1<sum2)
			printf("Radewoosh\n");
		else
			printf("Tie\n");
	}
	return 0;
}

Problem address: 【CodeForces】[658A]Bear and Reverse Radewoosh

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...