답안 #715106

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
715106 2023-03-25T22:30:24 Z The_Cat_Person Logičari (COCI21_logicari) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>

using namespace std;
int n;

int main()
{
	if ((((((((((((n%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2==1)/*not power of two*/
    {
      cout<<"-1"<<endl;
    }
  	else /*power of 2*/
	{
      cout<<n/2<<endl;
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:8:54: error: expected primary-expression before '%' token
    8 |  if ((((((((((((n%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2)%2==1)/*not power of two*/
      |                                                      ^