컴퓨터/알고리즘

|코린이의 코포| Round 698 Div.2 (A, B) 참고에 도움안되는 솔브

Round 698 Div.2 


A번 문제.

Problem - A - Codeforces

codeforces.com


|<algorithm>| 배열에 원소 가득채우는 "fill()" 함수 사용법

C++ 레퍼런스 - fill 함수 ()

modoocode.com


코드https://colorscripter.com/

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
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;
 
int num[101= { 0, };
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int Q;  cin >> Q;
    while (Q--)
    {
        int N; cin >> N;
        int mx = -123;
        for (int i = 0; i < N; i++)
        {
            int c; cin >> c;
            mx = max(++num[c], mx);
        }
        cout << mx << '\n';
        fill(num + 0, num + 1010);
    }
    return 0;
}
cs


B번 문제

Problem - A - Codeforces

codeforces.com


|<string>| : string을 숫자 자료형으로 변환하는 함수 stoi() stoll() 사용법

[C++] stoi, stof, stol, stod 함수에 대해서 (string to int)

안녕하세요. BlockDMask 입니다. 지난시간에는 C/C++에 기존에 존재하던 atoi, atof, atol등 char* 타입의 문자열을 정수로, 실수로 (=숫자로) 변경하는 함수에 대해서 살펴 보았습니다. 오늘은! C++11에서 부

blockdmask.tistory.com

코드https://colorscripter.com/

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <vector>
#include <string>
 
using namespace std;
 
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    long long Q; cin >> Q;
    while (Q--)
    {
        long long N; cin >> N; 
        string LUC; cin >> LUC;
        long long LUC_NUM = stoll(LUC);
 
        for (long long i = 0; i < N; i++)
        {
            string num; cin >> num;
            long long num_NUM = stoll(num);
            
            if (num.find(LUC) != string::npos)
                cout << "YES" << "\n";
            else if (num_NUM >= LUC_NUM*10)
                cout << "YES" << "\n";
            else //sum
            {
                bool is_yes = false;
                long long rear_num = num_NUM % 10;
                
                for (int j = 2; j <= 10; j++)
                {
                    if (rear_num == (LUC_NUM * j % 10&& !(num_NUM < LUC_NUM * j))
                    {
                        is_yes = truebreak;
                    }
                }
                
                if (is_yes)
                    cout << "YES" << '\n';
                else
                    cout << "NO" << '\n';
            }
        }
    }
 
    return 0;
}
cs

후기
A빠르게 풀어서 "D문제까지 렛츠기릿" 하고 

B도 "음 할만하네" 제출하고 C보고 있는중..

 
는데 왜틀림 당했... ㅠㅠㅠㅠ 

레드 쌉장인분한테 물어보니 제가 고려안한 부분이 있었다는걸 알게 되었습니다. 풀이에 대한 검증, 반례찾기 너무 못해서 위축되네여

암튼 멘탈 나가서 C는 커녕 B도 못풀어서 멘탈은 그라인더에 갈려서 스팸이 되버렸... 
ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ


나중에 다시 도전해서 맞았네요 ㅋ (그럼 뭐하노)