QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#507080 | #9107. Zayin and Count | WendyChen | WA | 14ms | 3552kb | C++20 | 1.4kb | 2024-08-06 10:15:12 | 2024-08-06 10:15:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define base 191
#define mod 1145141
#define inf 0x3f3f3f3f3f3f3f3f
const int N = 1e7 + 10;
int a[15], b[15];
int prea[15], preb[15];
int suma, sumb;
void solve() {
map<int, int> mp;
for (int i = 0; i <= 9; ++i) {
cin >> a[i];
suma += a[i];
if (i != 0) {
prea[i] = prea[i - 1] + a[i];
}
else {
prea[i] = a[i];
}
}
int cnt = 0;
for (int i = 0; i <= 9; ++i) {
cin >> b[i];
sumb += b[i];
if (b[i] == 1) {
mp[cnt] = i;
cnt++;
}
if (i != 0) {
preb[i] = preb[i - 1] + b[i];
}
else {
preb[i] = b[i];
}
}
string x;
cin >> x;
if (suma == sumb) {
for (int i = 0; i < x.size(); ++i) {
for (int j = 0; j <= 9; ++j) {
if (preb[j] == prea[x[i] - '0']) {
cout << j;
break;
}
}
}
cout << endl;
return;
}
else {
int num = (prea[x[x.size() - 1] - '0']) ;
int ans = suma;
for (int i = x.size() - 2; i >= 0; --i) {
num += (prea[x[i] - '0'] - 1) * ans;
ans *= suma;
}
stack<int> s;
num--;
while(num){
s.push(mp[num % sumb]);
num /= sumb;
}
while (s.size()) {
cout << s.top();
s.pop();
}
cout << endl;
}
}
signed main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int T = 1;
cin >> T;
while (T--) {
solve();
}
}
/*
1
1 0 1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0
20*/
詳細信息
Test #1:
score: 0
Wrong Answer
time: 14ms
memory: 3552kb
input:
10000 1 0 0 0 1 1 0 0 0 1 0 0 1 0 1 1 1 1 0 0 950595954440050004054505054050 1 0 0 0 1 1 1 1 0 0 1 1 1 0 1 0 0 0 1 1 45467007076660767550460064 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 23373171320213300170200722 0 0 0 0 1 1 1 0 1 0 0 0 1 0 0 1 0 1 1 1 558565664666565565558468668484 1 1 0 0 1 0 1 0 1 ...
output:
65266455722475422254727242 00000000000000000 3000400040400000 002000002000020 0000000020000 0000000000000 000000000000 000000000000 50708080507705588000780 600010000060 800000000080 00000080000 28100000000 00000000000 80000000000 00000000000 0000000000 0000000000 0000000000 0000000000 0000000000 000...
result:
wrong answer 1st lines differ - expected: '52755244567262766742575722', found: '65266455722475422254727242'