結果
問題 |
No.437 cwwゲーム
|
ユーザー |
|
提出日時 | 2019-01-09 23:41:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 930 bytes |
コンパイル時間 | 817 ms |
コンパイル使用メモリ | 85,836 KB |
実行使用メモリ | 13,824 KB |
最終ジャッジ日時 | 2024-11-24 01:01:25 |
合計ジャッジ時間 | 11,960 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | AC * 23 WA * 12 RE * 5 TLE * 1 |
コンパイルメッセージ
main.cpp: In function ‘int d(std::string)’: main.cpp:44:1: warning: control reaches end of non-void function [-Wreturn-type] 44 | } | ^
ソースコード
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string> #include<iostream> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include <sstream> #include<iomanip> #include <ctype.h> #include <fstream> #include <cassert> //#include <bits/stdc++.h> using namespace std; //#include<bits/stdc++.h> int d(string p) { int n = p.size(); int s = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { if (p[i] != '0'&&p[i] != p[j] && p[j] == p[k]) { int r = (p[i]) * 100 + (p[j] ) * 10 + p[k]-'0'*111; string x = p; x.erase(i, 1); x.erase(j-1, 1); x.erase(k-2, 1); s = max( d(x)+r, s); } } } return s; } } int main() { string p; cin >> p; cout << d(p) << endl; return 0; }