카타 8급 Total amount of points

1 C[ | ]

#include <stdlib.h>
int points(char* games[]) {
  int point = 0;
  for(int i=0; i<10; i++) {
    if( games[i][0]>games[i][2] ) point+=3;
    else if( games[i][0]==games[i][2] ) point++;
  }
  return point;
}

2 Python[ | ]

def points(games):
    point = 0
    for game in games:
        if game[0] > game[2]: point+=3
        elif game[0] == game[2]: point+=1
    return point
def points(games):
    point = 0
    for game in games:
        score = game.split(':')
        if score[0] > score[1]: point+=3
        elif score[0] == score[1]: point+=1
    return point
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}