結果
| 問題 |
No.2865 Base 10 Subsets 2
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-08-30 21:55:32 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 677 bytes |
| コンパイル時間 | 2,786 ms |
| コンパイル使用メモリ | 245,576 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-08-30 21:55:36 |
| 合計ジャッジ時間 | 3,400 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;
int main() {
string S;
cin >> S;
ll K;
cin >> K;
int N = S.size();
K--;
string ans = "";
for (int i = 0; i < N; i++) {
ll cnt = 1;
for (int j = i + 1; j < N; j++) {
cnt *= S[j] - '0' + 1;
}
int t = 0;
for (int j = 0; j <= S[i] - '0'; j++) {
if (cnt * j <= K) {
t = j;
}
}
ans += char('0' + t);
}
while (ans.size() > 1 && ans.front() == '0') {
ans.erase(ans.begin());
}
cout << ans << endl;
}
Today03