結果

問題 No.437 cwwゲーム
ユーザー olpheolphe
提出日時 2016-11-14 02:20:46
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,593 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 56,088 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 04:32:27
合計ジャッジ時間 2,913 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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