답안 #1011755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011755 2024-07-01T08:02:56 Z uranhishig Hotter Colder (IOI10_hottercolder) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

int Guess(int G);

int HC(int n){
	int q = 0, i;
	int w[501];
	bool x = true;
	bool xx = true;
   	for(int i = 1; i <= 500; i++){
   		w[i] = Guess(i);
   		if(w == -1){
   			if(xx){
   				q = i;
   				xx = false;
			}
   			x = false;
		}
   	}
   if(x){
   		cout << "500" << endl;
   }
   else{
   	   cout << q - 1 << endl;
   }

}#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

int Guess(int G);

int HC(int n){
	int q = 0, i;
	int w[501];
	bool x = true;
	bool xx = true;
   	for(int i = 1; i <= 500; i++){
   		w[i] = Guess(i);
   		if(w == -1){
   			if(xx){
   				q = i;
   				xx = false;
			}
   			x = false;
		}
   	}
   if(x){
   		cout << "500" << endl;
   }
   else{
   	   cout << q - 1 << endl;
   }

}

Compilation message

hottercolder.cpp:29:2: error: stray '#' in program
   29 | }#include <bits/stdc++.h>
      |  ^
hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:14:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |      if(w == -1){
      |         ~~^~~~~
hottercolder.cpp:8:13: warning: unused variable 'i' [-Wunused-variable]
    8 |  int q = 0, i;
      |             ^
hottercolder.cpp:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }#include <bits/stdc++.h>
      | ^
hottercolder.cpp: At global scope:
hottercolder.cpp:29:3: error: 'include' does not name a type
   29 | }#include <bits/stdc++.h>
      |   ^~~~~~~
hottercolder.cpp:35:5: error: redefinition of 'int HC(int)'
   35 | int HC(int n){
      |     ^~
hottercolder.cpp:7:5: note: 'int HC(int)' previously defined here
    7 | int HC(int n){
      |     ^~
hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:42:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   42 |      if(w == -1){
      |         ~~^~~~~
hottercolder.cpp:36:13: warning: unused variable 'i' [-Wunused-variable]
   36 |  int q = 0, i;
      |             ^
hottercolder.cpp:57:1: warning: no return statement in function returning non-void [-Wreturn-type]
   57 | }
      | ^