結果
| 問題 | No.1628 Sorting Integers (MAX of M) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-28 22:44:23 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 557 bytes |
| 記録 | |
| コンパイル時間 | 532 ms |
| コンパイル使用メモリ | 95,376 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-16 03:35:12 |
| 合計ジャッジ時間 | 1,577 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 6 |
ソースコード
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long LL;
int main()
{
int N,i;
cin >> N;
vector<int> myVec;
for (i = 1; i <= 9;i++) {
int c;
cin >> c;
for (int j = 0; j < c; j++) {
myVec.push_back(i);
}
}
LL Max = 0;
do {
LL M = 0;
int Len = myVec.size();
for (i = 0; i < myVec.size(); i++) {
M += myVec[i] * pow(10.0, Len - 1);
Len--;
}
if (Max < M) {
Max = M;
}
} while (next_permutation(myVec.begin(), myVec.end()));
cout << Max << endl;
return 0;
}