結果

問題 No.437 cwwゲーム
ユーザー olpheolphe
提出日時 2016-11-14 02:20:46
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,593 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 58,332 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-04 11:33:14
合計ジャッジ時間 1,606 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 1 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 1 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 1 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 1 ms
5,376 KB
testcase_41 AC 1 ms
5,376 KB
testcase_42 AC 1 ms
5,376 KB
testcase_43 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:37: warning: NULL used in arithmetic [-Wpointer-arith]
   11 |         for (int i = 0; num[i+2] != NULL; i++) {
      |                                     ^~~~
main.cpp:12:49: warning: NULL used in arithmetic [-Wpointer-arith]
   12 |                 for (int j = i + 1; num[j+1] != NULL; j++) {
      |                                                 ^~~~
main.cpp:14:63: warning: NULL used in arithmetic [-Wpointer-arith]
   14 |                                 for (int k = j + 1; num[k] != NULL; k++) {
      |                                                               ^~~~
main.cpp:18:83: warning: NULL used in arithmetic [-Wpointer-arith]
   18 |                                                 for (int l = i + 1; num[l + 2] != NULL; l++) {
      |                                                                                   ^~~~
main.cpp:20:99: warning: NULL used in arithmetic [-Wpointer-arith]
   20 |                                                                 for (int m = l + 1; num[m + 1] != NULL; m++) {
      |                                                                                                   ^~~~
main.cpp:22:111: warning: NULL used in arithmetic [-Wpointer-arith]
   22 |                                                                                 for (int n = m + 1; num[n] != NULL; n++) {
      |                                                                                                               ^~~~
main.cpp:26:131: warning: NULL used in arithmetic [-Wpointer-arith]
   26 |                                                                                                 for (int o = l + 1; num[o + 2] != NULL; o++) {
      |                                                                                                                                   ^~~~
main.cpp:28:147: warning: NULL used in arithmetic [-Wpointer-arith]
   28 |                                            

ソースコード

diff #

#include "iostream"
using namespace std;

char num[20];
int ans = 0;
int box[4] = {};
int flag[13];

int main() {
	cin >> num;
	for (int i = 0; num[i+2] != NULL; i++) {
		for (int j = i + 1; num[j+1] != NULL; j++) {
			if (num[i] != num[j]) {
				for (int k = j + 1; num[k] != NULL; k++) {
					if (num[j] == num[k]) {
						box[0] = (num[i] - '0') * 100 + (num[j] - '0') * 10 + num[k] - '0';
					//	cout << box[0] << "\n";
						for (int l = i + 1; num[l + 2] != NULL; l++) {
							if (l!=i&&l!=j&&l!=k) {
								for (int m = l + 1; num[m + 1] != NULL; m++) {
									if (num[l] != num[m]&&m!=i&&m!=j&&m!=k) {
										for (int n = m + 1; num[n] != NULL; n++) {
											if (num[m] == num[n] && n != i&&n != j&&n != k) {
												box[1] = box[0] + (num[l] - '0') * 100 + (num[m] - '0') * 10 + num[n] - '0';
												//cout << box[1] << "\n";
												for (int o = l + 1; num[o + 2] != NULL; o++) {
													if (o!=i&&o!=j&&o!=k&&o!=l&&o!=m&&o!=n) {
														for (int p = o + 1; num[p + 1] != NULL; p++) {
															if (num[o] != num[p]&& p != i&&p != j&&p != k&&p != l&&p != m&&p != n) {
																for (int q = p + 1; num[q] != NULL; q++) {
																	if (num[p] == num[q]&& q != i&&q != j&&q != k&&q != l&&q != m&&q != n) {
																		box[2] = box[1] + (num[o] - '0') * 100 + (num[p] - '0') * 10 + num[q] - '0';
																		//cout << box[2] << "\n";
																		for (int r = o + 1; num[r + 2] != NULL; r++) {
																			if (r != i&&r != j&&r != k&&r != l&&r != m&&r != n&&r != o&&r != p&&r != q) {
																				for (int s = r + 1; num[s] != NULL; s++) {
																					if (num[r] != num[s]&& s != i&&s != j&&s != k&&s != l&&s != m&&s != n&&s != o&&s != p&&s != q) {
																						for (int t = s + 1; num[t] != NULL; t++) {
																							if (num[s] == num[t]&& t != i&&t != j&&t != k&&t != l&&t != m&&t != n&&t != o&&t != p&&t != q) {
																								box[3] = box[2] + (num[r] - '0') * 100 + (num[s] - '0') * 10 + num[t] - '0';
																								//cout << box[3] << "\n";
																							}
																						}
																					}
																				}
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
						if (box[3] > ans)ans = box[3]; 
						if (box[2] > ans)ans = box[2]; 
						if (box[1] > ans)ans = box[1]; 
						if (box[0] > ans)ans = box[0]; 

					}
				}
			}
		}
	}
	cout << ans<<"\n";
	return 0;
}
0