top of page

CCC 2019 J1:Winning Score

This is simple math question.

Solution:

apoints = af*3 + as*2 + at

bpoints = bf*3 + bs*2 + bt

apoints > bpoints , print A

apoints < bpoints , print B

apoints = bpoints , print T



def whowin(a, b):

    suma = 3*a[0] + 2*a[1] + a[2]
    sumb = 3*b[0] + 2*b[1] + b[2]

    if suma == sumb:
        print("T")
    elif suma > sumb:
        print("A")
    else:
        print("B")


A = []
B = []

for i in range(3):
    S = input().rstrip().split()
    A.append(int(S[0]))

for i in range(3):
    S = input().rstrip().split()
    B.append(int(S[0]))

whowin(A, B)

Recent Posts

See All

CCC '24 J5 - Harvest Waterloo

#include<iostream> #include <vector> #include <algorithm> #include <cmath> #include <stack> using namespace std; int main() { int r, c, sr, sc; cin >> r; cin >> c; int p[r][c]; bool v

CCC '24 J4 - Troublesome Keys

#include <iostream> #include <string> #include <map> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main() { string ps; string ds; cin >> ps; cin >> ds;

CCC '22 J5 - Square Pool

#include<iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; bool rowcom(pair<int, int> a, pair<int, int> b){ return a.first < b.first; } bool colcom(pair<int,

Comments


bottom of page