답안 #53145

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
53145 2018-06-28T20:20:36 Z okaybody10 비밀 (JOI14_secret) C++
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
typedef long long ll;
ll T[1006];
int B[1006];
void Init(int N,int A[])
{
    for(int i=0;i<N-1;i++) T[i]=Secret(A[i],A[i+1]); 
}
int Query(int L,int R)
{
    if(R==L) return B[L];
    if(R==L+1) return T[L];
    int mid=(L+R)/2;
    return Secret(Query(L,(L+R)/2),Query((L+R)/2+1,R));
}
int main()
{
    int N; scanf("%d",&N);
    for(int i=0;i<N;i++) scanf("%d",&B[i]);
    Init(N,B);
    int Q; scanf("%d",&Q);
    while(Q--)
    {
        int x,y; scanf("%d %d",&x,&y);
        printf("%d\n",Query(x,y));
    }
    return 0;
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:15:9: warning: unused variable 'mid' [-Wunused-variable]
     int mid=(L+R)/2;
         ^~~
secret.cpp: In function 'int main()':
secret.cpp:20:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N; scanf("%d",&N);
            ~~~~~^~~~~~~~~
secret.cpp:21:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<N;i++) scanf("%d",&B[i]);
                          ~~~~~^~~~~~~~~~~~
secret.cpp:23:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int Q; scanf("%d",&Q);
            ~~~~~^~~~~~~~~
secret.cpp:26:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int x,y; scanf("%d %d",&x,&y);
                  ~~~~~^~~~~~~~~~~~~~~
/tmp/ccBbqA9y.o: In function `main':
secret.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccJBBJ13.o:grader-full.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status