답안 #97026

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97026 2019-02-13T11:42:06 Z Kastanda 질문 (CEOI14_question_grader) C++11
컴파일 오류
0 ms 0 KB
// And I was like ooo-eee-ooo
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
inline int Hash(int X, int Mod = 1997)
{
    vector < int > A;
    int M = X;
    while (M)
        A.pb(M % 3 + 19), M /= 3;
    M = X;
    while (M)
        A.pb((M % 2 + 3) * 2 + 11), M /= 2;
    int hsh = 0;
    for (int a : A)
        hsh = (hsh + a) * 1223 % Mod;
    return hsh;
}
int main()
{
    int N, T, X, Y;
    scanf("%d%d", &N, &T);
    for (; T; T --)
    {
        scanf("%d%d", &X, &Y);
        printf("%d\n", Hash(X) % 12 + 1);
    }
    return 0;
}
// White tiger's like ooo-aaa--oooo
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
inline int Hash(int X, int Mod = 1997)
{
    vector < int > A;
    int M = X;
    while (M)
        A.pb(M % 3 + 19), M /= 3;
    M = X;
    while (M)
        A.pb((M % 2 + 3) * 2 + 11), M /= 2;
    int hsh = 0;
    for (int a : A)
        hsh = (hsh + a) * 1223 % Mod;
    return hsh;
}
int main()
{
    int N, T, Q, H;
    scanf("%d%d", &N, &T);
    for (; T; T --)
    {
        scanf("%d%d", &Q, &H);
        if (Hash(Q) % 12 + 1 == H)
            printf("yes\n");
        else
            printf("no\n");
    }
    return 0;
}

Compilation message

encoder.cpp: In function 'int main()':
encoder.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &T);
     ~~~~~^~~~~~~~~~~~~~~~
encoder.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &X, &Y);
         ~~~~~^~~~~~~~~~~~~~~~
/tmp/ccXr246E.o: In function `main':
grader_encode.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccLiPDR2.o:encoder.cpp:(.text.startup+0x0): first defined here
/tmp/ccXr246E.o: In function `main':
grader_encode.c:(.text.startup+0x10a): undefined reference to `encode(int, int, int)'
collect2: error: ld returned 1 exit status

decoder.cpp: In function 'int main()':
decoder.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &T);
     ~~~~~^~~~~~~~~~~~~~~~
decoder.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &Q, &H);
         ~~~~~^~~~~~~~~~~~~~~~
/tmp/ccb3wFE9.o: In function `main':
grader_decode.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccJPGbss.o:decoder.cpp:(.text.startup+0x0): first defined here
/tmp/ccb3wFE9.o: In function `main':
grader_decode.c:(.text.startup+0x19f): undefined reference to `decode(int, int, int)'
collect2: error: ld returned 1 exit status