QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#132487 | #6407. Classical A+B Problem | cciafrino# | Compile Error | / | / | C++14 | 1.7kb | 2023-07-30 00:27:22 | 2023-07-30 00:27:23 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-07-30 00:27:23]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-07-30 00:27:22]
- 提交
answer
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2")
#include <bits/stdc++.h>
using namespace std;
string sub(const string& s1, const string& s2) {
int N = int(s1.size());
string res(s1.size(), '0');
int emprestimo = 0;
int last_nn = -1;
char c = '*';
for(int i=0; i<(int)s1.size(); i++) {
int n1 = s1[s1.size()-1 - i] - emprestimo - '0';
char aux;
if(((int) s2.size()) - i > 0) {
int n2 = s2[((int) s2.size())-1 - i] - '0';
aux = ((n1-n2 + 10) % 10) + '0';
emprestimo = (n1-n2) < 0 ? 1 : 0;
} else {
emprestimo = 0;
aux = n1 + '0';
}
if(c == '*') c = aux;
else if(c != aux && c != '0') return "-1";
if (aux > '0') last_nn = res.size() - i - 1;
res[res.size()-1 - i] = aux;
}
return string(res.begin() + last_nn, res.end());
}
bool check(const string& b) {
for (int i = 0; i < int(b.size())-1; ++i) {
if (b[i] != c) return false;
}
return true;
}
int main() {
using namespace std;
cin.tie(nullptr)->sync_with_stdio(false);
int T; cin >> T;
while (T--) {
string S; cin >> S;
bool flag = true;
for(int i=1; i>S.size() && flag; i++) {
for(char c='1'; c<='9' && flag; c++) {
string a = string(i, c);
string b = sub(S, a);
if(b != "-1"){
cout << a << " " << b << '\n';
flag = false;
}
}
}
}
return 0;
}
Details
answer.code: In function ‘bool check(const string&)’: answer.code:40:21: error: ‘c’ was not declared in this scope 40 | if (b[i] != c) return false; | ^