QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#763843#6621. Luggage LockSkyEyeControllerCompile Error//C++231.2kb2024-11-19 22:22:072024-11-19 22:22:08

Judging History

你现在查看的是最新测评结果

  • [2024-11-19 22:22:08]
  • 评测
  • [2024-11-19 22:22:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
string s, t;
int ans = 998244353;
void dfs(int i, string now, int nowcalc)
{
    if (i == 4)
    {
        ans = min(ans, nowcalc);
        return;
    }
    if (now[i] == t[i])
        dfs(i + 1, now, nowcalc);
    int delta = (t[i] - now[i] + 10) % 10;
    int revdelta = 10 - delta;
    for (int j = 1; j <= 4 - i; j++) // 同时转的长度
    {
        string tmp = now;
        for (int k = i; k < i + j; k++)
        {
            tmp[k] = ((tmp[k] - '0' + delta) % 10 + '0');
        }
        dfs(i + 1, tmp, nowcalc + delta);
        tmp = now;
        for (int k = i; k < i + j; k++)
        {
            tmp[k] = ((tmp[k] - '0' + 10 - revdelta) % 10 + '0');
        }
        dfs(i + 1, tmp, nowcalc + revdelta);
    }
}
void solve()
{
    cin >> s >> t;
    ans = 20;
    dfs(0, s, 0);
    cout << ans << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}

Details

answer.code:7:1: error: extended character   is not valid in an identifier
    7 |     if (i == 4)
      | ^
answer.code:7:3: error: extended character   is not valid in an identifier
    7 |     if (i == 4)
      |   ^
answer.code:8:1: error: extended character   is not valid in an identifier
    8 |     {
      | ^
answer.code:8:3: error: extended character   is not valid in an identifier
    8 |     {
      |   ^
answer.code:9:1: error: extended character   is not valid in an identifier
    9 |         ans = min(ans, nowcalc);
      | ^
answer.code:9:3: error: extended character   is not valid in an identifier
    9 |         ans = min(ans, nowcalc);
      |   ^
answer.code:9:5: error: extended character   is not valid in an identifier
    9 |         ans = min(ans, nowcalc);
      |     ^
answer.code:9:7: error: extended character   is not valid in an identifier
    9 |         ans = min(ans, nowcalc);
      |       ^
answer.code:10:1: error: extended character   is not valid in an identifier
   10 |         return;
      | ^
answer.code:10:3: error: extended character   is not valid in an identifier
   10 |         return;
      |   ^
answer.code:10:5: error: extended character   is not valid in an identifier
   10 |         return;
      |     ^
answer.code:10:7: error: extended character   is not valid in an identifier
   10 |         return;
      |       ^
answer.code:11:1: error: extended character   is not valid in an identifier
   11 |     }
      | ^
answer.code:11:3: error: extended character   is not valid in an identifier
   11 |     }
      |   ^
answer.code:12:1: error: extended character   is not valid in an identifier
   12 |     if (now[i] == t[i])
      | ^
answer.code:12:3: error: extended character   is not valid in an identifier
   12 |     if (now[i] == t[i])
      |   ^
answer.code:13:1: error: extended character   is not valid in an identifier
   13 |         dfs(i + 1, now, nowcalc);
      | ^
answer.code:13:3: error: extended character   is not valid in an identifier
   13 |         dfs(i + 1, now, nowcalc);
      |   ^
answer.code:13:5: error: extended character   is not valid in an identifier
   13 |         dfs(i + 1, now, nowcalc);
      |     ^
answer.code:13:7: error: extended character   is not valid in an identifier
   13 |         dfs(i + 1, now, nowcalc);
      |       ^
answer.code:14:1: error: extended character   is not valid in an identifier
   14 |     int delta = (t[i] - now[i] + 10) % 10;
      | ^
answer.code:14:3: error: extended character   is not valid in an identifier
   14 |     int delta = (t[i] - now[i] + 10) % 10;
      |   ^
answer.code:15:1: error: extended character   is not valid in an identifier
   15 |     int revdelta = 10 - delta;
      | ^
answer.code:15:3: error: extended character   is not valid in an identifier
   15 |     int revdelta = 10 - delta;
      |   ^
answer.code:16:1: error: extended character   is not valid in an identifier
   16 |     for (int j = 1; j <= 4 - i; j++) // 同时转的长度
      | ^
answer.code:16:3: error: extended character   is not valid in an identifier
   16 |     for (int j = 1; j <= 4 - i; j++) // 同时转的长度
      |   ^
answer.code:17:1: error: extended character   is not valid in an identifier
   17 |     {
      | ^
answer.code:17:3: error: extended character   is not valid in an identifier
   17 |     {
      |   ^
answer.code:18:1: error: extended character   is not valid in an identifier
   18 |         string tmp = now;
      | ^
answer.code:18:3: error: extended character   is not valid in an identifier
   18 |         string tmp = now;
      |   ^
answer.code:18:5: error: extended character   is not valid in an identifier
   18 |         string tmp = now;
      |     ^
answer.code:18:7: error: extended character   is not valid in an identifier
   18 |         string tmp = now;
      |       ^
answer.code:19:1: error: extended character   is not valid in an identifier
   19 |         for (int k = i; k < i + j; k++)
      | ^
answer.code:19:3: error: extended character   is not valid in an identifier
   19 |         for (int k = i; k < i + j; k++)
      |   ^
answer.code:19:5: error: extended character   is not valid in an identifier
   19 |         for (int k = i; k < i + j; k++)
      |     ^
answer.code:19:7: error: extended character   is not valid in an identifier
   19 |         for (int k = i; k < i + j; k++)
      |       ^
answer.code:20:1: error: extended character   is not valid in an identifier
   20 |         {
      | ^
answer.code:20:3: error: extended character   is not valid in an identifier
   20 |         {
      |   ^
answer.code:20:5: error: extended character   is not valid in an identifier
   20 |         {
      |     ^
answer.code:20:7: error: extended character   is not valid in an identifier
   20 |         {
      |       ^
answer.code:21:1: error: extended character   is not valid in an identifier
   21 |             tmp[k] = ((tmp[k] - '0' + delta) % 10 + '0');
      | ^
answer.code:21...