답안 #985888

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
985888 2024-05-19T08:24:24 Z simona1230 질문 (CEOI14_question_grader) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
int n,t;
int tp;

int x,y,q,h;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>tp;
	cin>>n>>t;
	if(tp==1)
    {
        for(int i=1;i<=t;i++)
        {
            cin>>x>>y;
            int j=0;
            while(((1<<j)&x)&&((1<<j)&y)||!((1<<j)&x)&&!((1<<j)&y))
                j++;

            if((1<<j)&x)j=j+1;
            else j=10+j+1;

            cout<<j<<endl;
        }
    }

    if(tp==2)
    {
        for(int i=1;i<=t;i++)
        {
            cin>>q>>h;

            int c1=0;
            if(h>10)h-=10,c1=1;
            h--;

            if((1<<(h%10))&q)
            {
                if(c1==0)cout<<"yes"<<endl;
                else cout<<"no"<<endl;
            }
            else
            {
                if(c1==0)cout<<"no"<<endl;
                else cout<<"yes"<<endl;
            }
        }
    }
	return 0;
}
/*
0
0
0
1
0
0

2
5 6
1 1
4 11
2 1
3 2
5 11
2 1

*/



    

Compilation message

encoder.cpp: In function 'int main()':
encoder.cpp:22:29: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   22 |             while(((1<<j)&x)&&((1<<j)&y)||!((1<<j)&x)&&!((1<<j)&y))
      |                   ~~~~~~~~~~^~~~~~~~~~~~
/usr/bin/ld: /tmp/ccElot5G.o: in function `main':
grader_encode.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccm5EYKI.o:encoder.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccElot5G.o: in function `main':
grader_encode.c:(.text.startup+0x129): undefined reference to `encode(int, int, int)'
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/ccKjArJr.o: in function `main':
grader_decode.c:(.text.startup+0x22f): undefined reference to `decode(int, int, int)'
collect2: error: ld returned 1 exit status