結果
問題 |
No.437 cwwゲーム
|
ユーザー |
![]() |
提出日時 | 2018-01-11 00:27:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,378 bytes |
コンパイル時間 | 859 ms |
コンパイル使用メモリ | 84,340 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-23 17:09:39 |
合計ジャッジ時間 | 2,127 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 WA * 11 |
ソースコード
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <cmath> #include <stack> #include <cctype> #include <stdio.h> #include <map> #include <string.h> using namespace std; int used_index[13]; int max_i; int max_j; int max_k; long long tmp_max = 0; long long ans=0; int main() { string s; cin >> s; bool judge = true; while (judge) { /* memset(used_index,0,sizeof(used_index));*/ judge = false; tmp_max =0; for (int i = 0; i < s.length() - 2; i++) { for (int j = i + 1; j < s.length() - 1; j++) { for (int k = j + 1; k < s.length(); k++) { if (s[j] == s[k] && s[i] != s[j]) { if (used_index[i] == 0 && used_index[j] == 0 && used_index[k] == 0) { if (tmp_max < (s[i] - '0') * 100 + (s[j] - '0') * 10 + s[j] - '0') { tmp_max = (s[i] - '0') * 100 + (s[j] - '0') * 10+ s[j] - '0'; max_i = i; max_j =j; max_k =k; /* cout<<max_i<<" "<<max_j<<" "<<max_k<<endl;*/ } /* cout << (s[i] - '0') * 100 + (s[j] - '0') * 10 + s[j] - '0' << endl;*/ judge = true; } } } } } if (judge) { /* cout<<tmp_max<<endl; return 0;*/ used_index[max_i] = 1; used_index[max_j] = 1; used_index[max_k] = 1; ans += tmp_max; } } cout<<ans<<endl; return 0; }