結果

問題 No.481 1から10
ユーザー GuestGuest
提出日時 2020-04-16 13:28:06
言語 C++11
(gcc 11.4.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 234 bytes
コンパイル時間 1,523 ms
コンパイル使用メモリ 54,752 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-09 19:10:10
合計ジャッジ時間 1,920 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 2 ms
6,940 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int solve(int*, int)’:
main.cpp:9:22: warning: control reaches end of non-void function [-Wreturn-type]
    9 |                 solve(B, i + 1);
      |                 ~~~~~^~~~~~~~~~

ソースコード

diff #

#include<iostream>
using namespace std;

int solve(int B[9], int i) {
	if (B[i - 1] != i) {
		return i;
	}
	else {
		solve(B, i + 1);
	}
}

int main() {
	int B[9];
	for (int i = 0;i < 9;i++) {
		cin >> B[i];
	}
	cout << solve(B, 1);
}
0