結果
問題 |
No.437 cwwゲーム
|
ユーザー |
![]() |
提出日時 | 2016-12-10 19:15:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 935 bytes |
コンパイル時間 | 635 ms |
コンパイル使用メモリ | 75,012 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-29 02:01:05 |
合計ジャッジ時間 | 2,088 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 WA * 8 |
ソースコード
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <set> #include <map> #include <algorithm> using namespace std; int main() { string N; long long score = 0; cin>>N; for(int i=9; 1<=i; i--){ for(int l=0; l<N.size(); l++){ if(N[l] == i + ('0' - 0)){ for(int j = 0; j<=9; j++){ if(i == j) continue; int cnt = 0, index[2]; bool flag = false; for(int r=N.size()-1; l<r; r--){ if(N[r] == j + ('0' - 0)){ index[cnt] = r; cnt++; if(cnt == 2){ N[l] = '*'; N[index[0]] = '*'; N[index[1]] = '*'; score += 100*i + 10*j + j; flag = true; break; } } } if(flag) break; } } } } cout<<score<<endl; return 0; }