대회 후기를 써볼려고 한다..

사실 이 대회는 끝나기 약 15분 전에 들어와서 2문제 밖에 풀지 못했는데, 지금껏 내가 한 대회 중(몇개 안되지만) 가장 빨리 2개를 푼 셋이라 한번 올려본다.

앞으로는 모든 대회에 대한 후기를 올리도록 하겠다.

 

A. Determinant(100)

Problem Statement

Given is a  matrix A=[a b

                                                            c d].
The determinant of  can be found as 
Find it.

Constraints

  • All values in input are integers.

#include<stdio.h>
int main()
{
    int a,b,c,d;
    scanf("%d %d\n%d %d",&a,&b,&c,&d);
    printf("%d",a*d-b*c);
}

 

B. Quizzes(200)

Problem Statement

Takahashi will answer  quiz questions.
Initially, he has  points. Each time he answers a question, he gains 1 point if his answer is correct and loses  point if it is incorrect.
However, there is an exception: when he has 0 points, he loses nothing for answering a question incorrectly.

You will be given a string  representing whether Takahashi's answers are correct.
If the i-th character of  from the left is o, it means his answer for the i-th question is correct; if that character is x, it means his answer for the i-th question is incorrect.
How many points will he have in the end?

Constraints

  • 1≤N≤2×105
  • 0≤X≤2×105
  •  is a string of length consisting of o and x.

역시 간단한 구현 문제이다.

[88:09 AC]

 

#include <stdio.h>
int main()
{
    int i,a,b;
    char n;
    scanf("%d %d\n",&a,&b);
    for(i=0;i<a;i++)
    {
        char n;
        scanf("%c",&n);
        if(n=='o')
        {
            b++;
        }
        if(n=='x')
        {
            if(b==0)
            {
                b=0;
            }
            else
            {
                b--;
            }
        }
    }
    printf("%d",b);
    return 0;
}

 

대회 중에는 여기까지 풀었다.

늦게 들어와서 등수가 많이 떨어졌다.

C번은 업솔빙 예정이다.

'대회 후기 > Atcoder' 카테고리의 다른 글

AtCoder Beginner Contest 189 후기  (0) 2021.01.24
Atcoder Beginner Contest 186  (1) 2020.12.26
Atcoder Beginner contest 185 후기  (0) 2020.12.19

+ Recent posts