제출 #286340

#제출 시각아이디문제언어결과실행 시간메모리
286340AaronNaidu저울 (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; int t; int answerVector[6]; void init(int T) { t = T; } /*int getLightest(int a, int b, int c) { cout << "Lightest of " << a << " " << b << " " << c << "\n"; int ans; cin >> ans; return ans; } int getMedian(int a, int b, int c) { cout << "Median of " << a << " " << b << " " << c << "\n"; int ans; cin >> ans; return ans; } void answer(int v[6]) { cout << "Answer:\n"; for (int i = 0; i < 6; i++) { cout << v[i] << " "; } }*/ assign(int a, int b, int c, int d, int e, int f) { answerVector[0] = a; answerVector[1] = b; answerVector[2] = c; answerVector[3] = d; answerVector[4] = e; answerVector[5] = f; } void orderCoins() { int a = getLightest(1, 2, 3); int b = getMedian(1, 2, 3); int c; for (int i = 1; i <= 3; i++) { if (i != a and i != b) { c = i; } } int d = getLightest(4, 5, 6); int e = getMedian(4, 5, 6); int f; for (int i = 4; i <= 6; i++) { if (i != d and i != e) { f = i; } } int x; x = getMedian(d, a, b); if (x == b) { int y = getMedian(b, c, d); if (y == c) { assign(a, b, c, d, e, f); answer(answerVector); return; } else { y = getMedian(d, c, e); if (y == c) { assign(a, b, d, c, e, f); answer(answerVector); return; } y = getMedian(e, c, f); if (y == c) { assign(a, b, d, e, c, f); } else { assign(a, b, d, e, f, c); } answer(answerVector); return; } } if (x == d) { int y = getMedian(e, b, c); if (y == c) { assign(a, d, b, c, e, f); answer(answerVector); return; } if (y == b) { int z = getMedian(b, c, f); if (z == b) { assign(a, d, e, f, b, c); answer(answerVector); return; } if (z == c) { assign(a, d, e, b, c, f); answer(answerVector); return; } assign(a, d, e, b, f, c); answer(answerVector); return; } int z = getMedian(e, c, f); if (z == f) { assign(a, d, b, e, f, c); answer(answerVector); return; } assign(a, d, b, e, c, f); answer(answerVector); return; } x = getMedian(e, a, b); if (x == e) { int y = getMedian(b, c, f); if (y == b) { assign(d, a, e, f, b, c); answer(answerVector); return; } if (y == c) { assign(d, a, e, b, c, f); answer(answerVector); return; } assign(d, a, e, b, f, c); answer(answerVector); return; } if (x == b) { int y = getMedian(b, e, c); if (y == c) { assign(d, a, b, c, e, f); answer(answerVector); return; } y = getMedian(e, c, f); if (y == f) { assign(d, a, b, e, f, c); answer(answerVector); return; } assign(d, a, b, e, c, f); answer(answerVector); return; } x = getMedian(f, a, b); if (x == a) { assign(d, e, f, a, b, c); answer(answerVector); return; } if (x == f) { assign(d, e, a, f, b, c); answer(answerVector); return; } x = getMedian(b, c, f); if (x == f) { assign(d, e, a, b, f, c); answer(answerVector); return; } assign(d, e, a, b, c, f); answer(answerVector); return; }

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp:35:48: error: ISO C++ forbids declaration of 'assign' with no type [-fpermissive]
   35 | assign(int a, int b, int c, int d, int e, int f) {
      |                                                ^
scales.cpp: In function 'int assign(int, int, int, int, int, int)':
scales.cpp:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
   42 | }
      | ^